Ttelmah Guest
|
|
Posted: Tue Mar 03, 2009 3:49 pm |
|
|
According to me, it should be 1024, not 1023.....
The point is that normal ADC's, have 1023 'steps', so though the value goes to 1024, the divisions needed to get the volt per division, is normally 1023.
This is like the difference between the number of posts in a fence, and the number of panels. 1024 posts, but only 1023 panels.
A lot of people here post using 1023 for the division, which is correct for 90% of ADC's. However the PIC ADC, actually reaches 1024, before you get to the full voltage, and the transition from 0 to 1, at the bottom of the range is also displaced, occuring one whole step 'up', instead of at the normal half step point. So though the A/D reads to 1024, and would therefore normally be expected to split the Vref into 1023 steps, it is closer approximated by using 1024.
It actually gets even slightly more complex. Because of the offset in the step locations, the best approximation, is to add 1/2 of the step to the final value as well.....
So, the closest approximation to the actual pin voltage, for a given ADC reading, fo the PIC 10bit ADC, is:
Vstep=Vref/1024
Reading(volts) = (ADC_reading*Vstep)+(Vstep/2)
Best Wishes |
|