DAC w/ PWM output using resistor/capacitor
smbaker
Posts: 164
I was skimming through application note AN001 and had a few questions... I'm looking to get some simple digital-to-analog conversion. So far I've been using the first technique presented (NCO/PWM counter mode). I don't see an identifier for the listing, but it's the code that appears on page 7, immediately preceding figure 6. I'm presently having good luck with that code, using a resistor/capacitor to get my DAC conversion.
There's a second technique further down using DUTY mode (page 13, right before figure 11). My questions:
1) Which technique is better for D to A conversion? Specifically, I'm looking at something where I can get approximately 8 bits of resolution between approximately 0 - 3.3V.
2) At first glance, the DUTY mode technique looks like I should be able to load up FRQA with some fraction of 2^32 and that will determine my duty cycle (and furthermore, the output voltage). It looks like I ought to be able to simply set it and forget it. I'm confused as to why this example uses a second cog with an assembly routine. All it seems to be doing is copying the desired duty cycle into FRQA.
So far I've been avoiding learning how the counters work, it's time for me to jump in and start using them!
Thanks,
Scott
There's a second technique further down using DUTY mode (page 13, right before figure 11). My questions:
1) Which technique is better for D to A conversion? Specifically, I'm looking at something where I can get approximately 8 bits of resolution between approximately 0 - 3.3V.
2) At first glance, the DUTY mode technique looks like I should be able to load up FRQA with some fraction of 2^32 and that will determine my duty cycle (and furthermore, the output voltage). It looks like I ought to be able to simply set it and forget it. I'm confused as to why this example uses a second cog with an assembly routine. All it seems to be doing is copying the desired duty cycle into FRQA.
So far I've been avoiding learning how the counters work, it's time for me to jump in and start using them!
Thanks,
Scott
Comments
PWM is better for controlling inductive loads like motors, since you can drive them directly with transistors that alternate between full saturation and non-conduction, without spending time in their linear regions. The load inductance, in these cases, is what smooths the current.
-Phil
For fixed frequency PWM (NCO) you need a cog and can only do 2 PWMs with it. But you have control over the frequency and pulslength so it's more EMC save.
Andy