选择ADCn_INx
Analog中选择
double GetADC(ADC_HandleTypeDef *ADCn)
{
double Value;
HAL_ADC_Start(ADCn);
Value = HAL_ADC_GetValue(ADCn);
HAL_ADC_Stop(ADCn);
return Value*3.3/4096;//12位ADC 2^12 = 4096
}
HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);//在main 中 while前校准ADC
HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
char text[20];
sprintf(text, " V2:%.2lf ", GetADC(&hadc1));
LCD_DisplayStringLine(Line3, (uint8_t *)text);//显示
Comments NOTHING