接着书写单次采集程序
HAL_ADCEx_Calibration_Start(&hadc1); //ADC校准
HAL_ADC_Start(&hadc1); //启动ADC转换
HAL_ADC_PollForConversion(&hadc1, 50); //等待ADC1转换完毕,这里最多等待50ms
ADC_Value = HAL_ADC_GetValue(&hadc1); //获取ADC的值,结果存放在ADC_Value里面
printf("ADC value is %d\n", ADC_Value);
printf("ADC actural value is %.2f\n", ADC_Value * 3.3 / 4095);
|