Hi,And has been answered IMO.....But the original question remains
You use some kind of voltage reference chip that produces a stable reference voltage over the whole operating range of your batteries. Let's say that voltage is 2.048V. You connect this reference voltage to the Vref pin on the PIC and set the ADC up to use that pin as Vref+ instead of Vdd.
Now you create a resistor network between Vdd and Vss and choose the resisitor values so that the voltage over the lower resistor is as close to 2.048V as possible when the batteries are fully charged. You connect this "signal" to the analog input of your choise.
Now the ADC will give you a reading of 2mV/count.
There is no way to internally "connect" Vdd to an analog input - except to the Vref+ pin. And there is no way to do measure Vdd without using an external reference voltage.
/Henrik.
Bookmarks