Hello engineers,
I'm trying to measure a battery on my C5535 board, but I have trouble in calculating the GPAIN0 voltage from SAR A/D data.
The register settings are:
SARCTRL = 0x1400
SARCLKCTRL = 0x007F
SARPINCTRL = 0x3602
SARGPOCTRL = 0x0000
The Reference Voltage is Bandgap 1V, and the Technical Reference Manual says that the SAR Channel 1 reads 1/8 * GPAIN0.
For example, if I apply 1.5V on the GPAIN0 pin, the A/D data (SARDATA::ADCDAT) should be
((1.5V / 8) / 1V) * 1024 = 192 (= 0x0C0)
Am I right?
In fact, when I apply 1.5V on GPAIN0, the A/D data reads approximately 880 (= 0x370).
I don't know how to calculate the battery voltage from the SAR A/D value, and in addition, I'm in a frightful hurry.
Any advice will be greatly appreciated.
Thank you!