DAC PWM charge up speed
kevinj
Posts: 9
The Basic Analog and Digital guide shows how to create a DAC. I've tried this and it works with the Basic Stamp.
My question regards the choice of the R and C. I want to lower each so my charge time is only 1 micro second or·as low as possible·to output a 0 to 5 volt signal.
Do I need a faster processor to do this? Is there a formula relating pulse width to charge time (R & C)?
Specifically, what would the cycles formula be?
Thank you.
Post Edited (kevinj) : 3/26/2007 12:22:27 AM GMT
My question regards the choice of the R and C. I want to lower each so my charge time is only 1 micro second or·as low as possible·to output a 0 to 5 volt signal.
Do I need a faster processor to do this? Is there a formula relating pulse width to charge time (R & C)?
Specifically, what would the cycles formula be?
Thank you.
Post Edited (kevinj) : 3/26/2007 12:22:27 AM GMT
Comments
I took your comment to mean there's a capacitor involved... capacitors take longer than a resistor ladder, I believe. I may be entirely wrong, though.
I would like to know how the frequency of the stamp (PWM) comes into play because if you choose your RC circuit with small values (1KOhm and 1nF) vs. large values (10KOhm and 1uF as given in the tutorial/"basic analog and digital guide") you can make a very fast DAC.
Does that make sense? Thanks. kevinj.
The frequency of the PWM statement doesn't really apply since it's not really intended for very fast DAC. It basically puts out a pseudo-random pulse sequence for a specified time that is averaged by the RC network to produce the voltage requested. Once the statement finishes, the pulse train ceases and the capacitor acts as a "sample and hold" to maintain the output voltage.
But my question is about using the stamp·and a·RC to implement·a fast DAC.
I wanted to know if I use a small R and a small C then I should be able to create the fastest DAC in the world.
I know this isn't possible, and I wanted to know what the bottle neck is. Is it the PWM output frequency?
Is there a formula relating PWM frequency to RC?
I suggest you learn something about RC networks (en.wikipedia.org/wiki/RC_time_constant).
The PWM statement puts out a pulse train as mentioned. The typical pulse width is related to the instruction time of the processor chip used. I don't know exactly what that is, but it's probably on the order of 1-2us (pulse width that is) for the BS2. The RC network acts as a filter for this and smooths it so that the filter output is very close to the average "on time" of the pulse train. You can't change the pulse width so, if the RC network's time constant is too short, the output voltage will "sag" between pulses and you'll lose accuracy.
It is possible to create DACs using this technique, but at a faster pulse rate. The Propeller uses this technique to do DAC. The problem is that, as the frequency gets higher, other things interfere. Lead inductance and lead length to the RC components starts to cause problems. Power consumption is related to switching frequency by a power law (square?). If you look at the fastest DACs, they're all resistor ladder. Doing multiple bits at a time is always faster than one bit at a time and, often with ICs, may even be cheaper.