Page 1 of 1
volatge measurement on ADC0 pin
Posted: Mon Jul 06, 2015 8:23 am
by Capture
I written the program for measuring the voltage in ADCO pin by considering the 5V DIFF as reference after compiling it is displaying 1.4 V only but if i measure the same pin by using micrometer it is displaying 3.7V ,i did lot of modification to solve this issue but still encountering the same issue so can anyone suggest me how to solve this problem ?
(// Print out current Battery sataus
tfp_printf("adc0 pin viltage:%d mV\r\n",
TD_MEASURE_SingleVoltage(adcSingleInpCh0,adcRef5VDIFF));
Thank you in advance
Prabhu
Re: volatge measurement on ADC0 pin
Posted: Mon Jul 06, 2015 9:06 am
by mstempin
The 5V DIFF ADC mode is measuring the difference between the + and - SAR ADC inputs.
You are using ADC0 as first input (ADC0_CH6), but the second input defaults to internal +1.25 V reference. However, the TD_MEASURE_SingleVoltage() function initialize the ADC structure in single-ended mode, thus the strange result.
Also, be careful not to exceed the maximum GPIO voltage on these pins (+3.8V).
If measuring voltage from a LiPo battery that can go up to +4.2 V, I strongly suggest to use a voltage divider to bring the measured voltage down to reasonable values and use a non-differential ADC range within the recommended voltage range < +3.8 V. For example, you can use 2x high same value (a few Mohms) 1% resistors between VCC and GND, and connect the middle point to ADC0 input, then multiply converted value by 2.
Re: volatge measurement on ADC0 pin
Posted: Mon Jul 06, 2015 10:23 am
by Capture
i have changed the reference to adcRef 1V25 and then it is displaying the output 4096mV (4.2v IN EVALUATION BOARD)
// Print out current ADC0 VALUE
tfp_printf("adc0 pin voltage:%d mV\r\n",
TD_MEASURE_SingleVoltage(adcSingleInpCh6,adcRef1V25));
and for Aadcref5VDIFF it is displaying 1935mV(2v without connecting the battery)
I really dont understand this problem and can you please suggest me some ways to find the correct solution for this problem
Thank you
Prabhu