This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541电量检测计算公式对吗

Other Parts Discussed in Thread: CC2541, TPS61220

CC2541采用TPS61220提供稳定的3.0V供电,所以,ADC的参考源我选取了HAL_ADC_REF_AVDD

P0_7为纽扣电池电压检测管脚(通过2kohm串阻接入),实现代码:

HalAdcSetReference( HAL_ADC_REF_AVDD );
adc = HalAdcRead( HAL_ADC_CHN_AIN7, HAL_ADC_RESOLUTION_10 );

计算方法:设置3.0V为511 对应100%电量,计算得到2.0V的ADC值为341,对应0%电量,由此得出:

(ADC-341)/(511-341)=persent / 100

--->percent = (uint8) (adc - 341) * 100 /170;

我这样计算方法对吗?但实测误差很大,万用表测试为2.808V,而读到的电量为52%(理应为80.8%)