Correction:
12 bit A/D count = 4095 when Vin = Vref
Correction:
12 bit A/D count = 4095 when Vin = Vref
Charles Linquist
Thanks Charles,
I think I grasp that concept.
350/1024 = .3418 ... so for every .3418 volt change at the 350 side of things, there is a "count" change.
Therefore, if we start with, say:
165 vdc
...through the voltage scaler to the ADC in:
165/70 = 2.3571 vdc
VRef(5.1)/1024 = .004883
2.3571/.004883 = 482.7115 <<<<<<<<<<<<<<<<<<< The ADC "count" would be 482?
(ADC count * 4883 * Scaler ratio) / 10000
(482*4883*70) / 10000 = 16475.242<<<<<<<<<<<<<<<<< 16475 is the "high voltage"?
...for the lcd:
LCDOut 16475/100,".",16475//100," VDC"
"164.75" <<<<<<<<<<<<<<<<<<<<<<<<< Where did I go wrong in not getting "165"?
I am probably confusing myself more than I'm helping.
Would love a quick tutorial from one of you knowledgeable folks.
Thanks again,
Chris
At the risk of confusing you more...
http://www.picbasic.co.uk/forum/cont...Sensor-Scaling
Dave
Always wear safety glasses while programming.
Thanks Mack,
Funny you point out that thread... That's the one I've been racking my brain over.
I'll take another look though.
Chris
Hey Mack,
Quick question. When we're talking about the ADC count based on the sampled voltage,
what happens to the count when it's fractional?
IE:
count = 557.26 ... does this become 557 or 558?
count = 952.76 ... does this become 952 or 953?
I guess I'm just wondering what the "rounding" routine is, if any?
Thanks again,
Chris
Dave
Always wear safety glasses while programming.
Thanks for the heads up Mack,
I guess I was a bit confused by this in your ADC scaling tutorial:
Why would that read 205, instead of 204?Code:Convert this to an 10 bit PIC® resolution. 10 bits ADC = 0 to 1023, 1024 steps. At 5.0 volts one volt of input will will read 205. (204.6 actually)
Thanks Mack, for helping a newbie trying to understand.
Chris
Bookmarks