Anurag Chugh wrote:
why only PWM?.. why not use an R2R
ladder instead with precision resistors...
i know they would hog a whole PORT
but arent they easier to implement ??
and they can do DC output values
too... a simple opam in front (voltage follower) will boost current
output too...
i am sure most people dont use
R2R... but please tell me why?? i know there must be a reason...
Anarag:
I can speak only for myself. Consider an R-2R ladder for 8 bit
DAC: it contains 16 resistance elements. Now, let us assume that each
of these resistance elements is an indiivdual 1% tolerance resistor.
Total overall tolerance of the R2R ladder is now 16% (not very good, is
it?) 1% resistors cost between $0.15 and $0.25, depending on where
you purchase them and how many you purchase 9unless you're puschasing
thousands, of course). Somewhere between $2.40 and $4.00 for A +/- 16%
dac? *HORRIBLE*
Assuming you can obtain (at any price) +/- .1% resistors (at any
price), you still have only +/- 1.6% tolerance, at a trmendously higher
price.
Now, consider 8 bit PWM as implemented using an AVR. Tolerance is
going to be +/- 1/255 of Vcc. Assuming a +/- 5% tolerance on your Vcc
(which you *REALLY* ought to have, for correct AVR operation), this
yields an "absolute" tolerance of +/- 1.9%, at ZERO additional
hardware cost (unless you need post filtering, in which case, a .25W,
5% resistor and a small cap cost what, maybe $0.25 in combination?).
Of course, there is the question of software devlopment costs, but 1)
those are one time engineering costs, not repeating BOM (bill of
materials) costs, and 2) let's face it, PWMing ADC is pretty straight
forward, and takes very little time and effort to program, thanks to
the foresight and engineering skills of the engineers at Atmel.
Granted, 8 bit PWWM isn;t going to yield great results for, say audio
purposes, but then, neither is an 8 bit R2R ladder (in fact, pretty
much exactly the same results, in terms of signal fidelity/distortion).
If I have gone on too long, my apologies.
Tom