Hi Roger.
I am looking now the latest Data sheet (version F) of the chip and it seems that this chip supports 0,6 Volt reference only for the comparator. The ADC can be referenced internally byt the VCC or externaly on pin 18.
Sorry for the late detailed reply. It is my fault I did not check the data sheet earlier.
So in your case you have to use the internal reference to Vcc (that is 5V in your case), with ADCON0 set as it is now and read the input on your pin, which I suppose is PortC.0 with the
ADCIN 4,Bat_Value (Not 13 as in your program).
The other option you may have, is to use the comparator, and when the voltage of the divider trips under the reference, to have an interrupt, or just look for the comparator out if it is set. But you cannot have the exact battery value.
Ioannis
Bookmarks