Ethan Dicks wrote:
On 7/2/06, Chuck Guzis <cclist at sydex.com>
wrote:
I've built that first simple ladder DAC (to hang a 1950s Triplett
meter off of a parallel port for just random analog fun)... the
problem is that it's difficult to tune the individual resistors to
prevent the needle (or voltage) from going visibly *down* when
transitioning the DAC from, say, 0x3F to 0x40 or 0x7F to 0x80. The
cumulative errors of the low order bits can get to the point that you
don't get a constant output increment by incrementing the digital
value. The needle did deflect from 0 to full, but writing a ramping
program showed very clearly that it wasn't a continuous progression.
What I really would like to find is a formula for calculating R2R
ladder values so that I could get a 0V-5V output from an 8-bit
parallel port. Constructing it is easy, once one knows what resistors
to pick.
The "right values" are 'R' and '2*R' -- the trick is picking
that *one* 'R'. Much easier than building a resistor network
out of R, 2R, 4R, 8R...
You have to take into account the input impedance of your
meter. It is not infinite so *it* affects the voltage
seen at the meter. Try the same experiment with a
DMM for different results. :> (your VOM will have a marking
indicating "XXX ohms / volt" which characterizes it's impedance)
You need a low enough value of R so that your load has negligible
effect. OTOH, a TTL output port will not *source* much current.
So, lower values of R tax the output drive capability of the port.
And, doesn't really give you +5V as a HI. A CMOS output will
be better in both cases (drives closer to the rails and can
source as well as sink current).
You could also put a unity gain buffer on the output to
give you a lower output impedance which will isolate the effects
of your meter (load) from the R-2R ladder. If you were using
this to generate e.g. audio, then the audio amp acts as this
buffer.
I frequently use R-2R ladders on small MCU's (like PIC's)
for things like sound generators. Your ear is quite tolerant
of these small mismatches (if R & 2R are on the same thickfilm
substrate, they tend to track pretty well) in resistance
(which translate to nonlinearities and nonmonotonic transfer
functions).
Analog Devices used to publish an excellent cookbook of A/D
and D/A techniques. Worth having.