我无法理解 VREFINT 在 stm32f103 板上的使用。谁能解释我如何使用 VREFINT 在 stm32f103 中获取 adc 值?
if(HAL_ADC_PollForConversion(&hadc1, 100) == HAL_OK)
{
adcVrefInt = HAL_ADC_GetValue(&hadc1);
vdd = 4095.0 * 1.20 / (float)adcVrefInt;
vdd += 0.61; // .61 is the difference i'm getting in VDD
sprintf(buffer, "VREFINT: %ld\tVDD: %.2f\t", adcVrefInt, vdd);
HAL_UART_Transmit(&huart1, (uint8_t *)buffer, strlen(buffer), 100);
if(HAL_ADC_PollForConversion(&hadc2, 100) == HAL_OK)
{
adcValue = HAL_ADC_GetValue(&hadc2);
adcVoltage = (vdd/4095.0) * adcValue;
sprintf(buffer, "ADC_PA0: %ld\tVoltage-PA0: %.2f\n", adcValue, adcVoltage);
HAL_UART_Transmit(&huart1, (uint8_t *)buffer, strlen(buffer), 100);
}
}