Re: Figuring out the Fixed Voltage Reference (FVR) 12F1822 (and others)
Most of what I learned and the Code samples I used came from this other thread...
http://www.picbasic.co.uk/forum/showthread.php?t=17321
I'd be happy to share anything I learned with others...
Mostly what I had to understand was that whatever you use as the ADC voltage reference (VDD, FVR, or External Vref+ on AN1) will be equivalent to 1023 counts (10bit) and the analog voltage you are trying to read will be measured against that (and cannot exceed that REF without employing some sort of voltage divider to scale it down.)
So if you program the FVR to be 1.024v then that will be 1023 counts and your analog input cannot exceed that.
When your external analog input is the same voltage as what ever you have chosen as the reference (via ADCON1) it will also read as 1023 counts. So if you set the FVR to be 4.096v then your analog input will also show 1023 counts when it reaches 4.096 volts.
If you want to calibrate the FVR (ie. find out what it actually is internally [since, as Darrel pointed out] it will likely only be close to the data sheet value)
then set the registers (ADCON0, ADCON1 & FVRCON) so that the ADC uses VDD for the reference and do an ADCIN 31 (which is the FVR channel) you can then (using an accurate voltmeter) measure your VDD, and compare the reading you get from the FVR (ADCIN 31) and then do a simple ratio to determine the real FVR voltage.
ie. if your VDD is 4.500 volts and you read 233 counts on ADCIN31 then 4500/1023 = ?(FVR actual)/233 So the answer is FVR real = 1024.9 mv or 1.0249 volts. Continuing with that same test but this time setting the FVR to be 4.096 (by changing FVRCON) and you read 930 counts on an ADCIN31 then...
4500/1023 = ?/930 then the FVR is actually putting out 4.0909v NOT 4.096v.
You can then use the above information to adjust your calculations when using the FVR as the reference to an external AD measurement.
I hope this helps others understand. And if I got something wrong here please correct me.
I am by no means an expert but it helps me to understand it just by writing it here.
Last edited by Heckler; - 18th February 2014 at 02:59.
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks