STM32
直播中

王秀珍

8年用户 1547经验值
私信 关注
[问答]

为什么ADC转换锂电池出来的是2.5左右,而万用表却是3.3?

测试代码如下:
uint32_t ResultVolt = 0;
  uint8_t i;
  for(i=0; i<8; i++)
  {                                              //等待转换完成
    while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET);
    ResultVolt +=(uint32_t) ADC_GetConversionValue(ADC1);
  }
  ResultVolt = ResultVolt >> 3;                  //求平均(除8)
  ResultVolt = (ResultVolt*3300) >> 12;          //计算得到1000倍的电压值(整数值, 无小数点)
  return ResultVolt;


回帖(1)

王禅

2024-4-17 15:30:01
像是硬件的问题
举报

更多回帖

发帖
×
20
完善资料,
赚取积分