At 05:08 15/11/96 -0600, John Payson wrote: >> > In one ap I'm doing where I need 12 bits A to D, I take a port pin output, >> > run it through an RC filter, and then run that into a comparator along with >> > the input signal. In my timer tick, I set that output port to match the >> > input port and increment a count if it was "high"; every 4096 loops I store >> > the count, zero it, and start again. Seems to work pretty well, though I >> > don't get readings all that fast. > >From my limitted experience with this technique, it seems to work pretty >well. There's a little bit of jitter on the readings (about 3 counts out >of 4096) but not much; I expect the technique will be reasonably noise- >immune since repeated glitched readings which go in the same direction will >cause any non-glitched readings to go in the other direction thereby cancel- >ing out the glitches. The only difficulty I've seen with this technique >is that it's not terribly fast. There is another variety of this method: you use a PWM output with a filter as a DAC, and feed it back with the input into a comparator. Now you use a control loop for the DAC so that the comparator output toggles on and off all the time. This way you might get more control over the speed the DAC follows the input. The DAC value is the estimate for the input.