PRIVATE void readbattery_adc(){ uint16 u16batv;uint16 u16adc;vAHI_ApConfigure(E_AHI_AP_REGULATOR_ENABLE,//使能转换E_AHI_AP_INT_DISABLE,//使能中断E_AHI_AP_SAMPLE_2,//采样周期倍数2xE_AHI_AP_CLOCKDIV_500KHZ,//时钟分比E_AHI_AP_INTREF//内部参考电压);bAHI_APRegulatorEnabled();vAHI_AdcEnable(E_AHI_ADC_CONTINUOUS,E_AHI_AP_INPUT_RANGE_2,E_AHI_ADC_SRC_VOLT);vAHI_AdcStartSample();while( bAHI_AdcPoll()!=0x00){u16batv=u16AHI_AdcRead();}u16adc=((uint32)(uint32)(u16batv*234))/1000;vAHI_AdcDisable();}
- 1 回答
- 0 关注
- 172 浏览
添加回答
举报
0/150
提交
取消