以下是使用STM32的C语言编写的用STM32F103C8T6 ADC采集电压的程序:
- #include "stm32f10x.h"
-
- void ADC_Configuration(void)
- {
- ADC_InitTypeDef ADC_InitStructure;
- GPIO_InitTypeDef GPIO_InitStructure;
-
- // 使能ADC1和GPIOA的时钟
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_GPIOA, ENABLE);
-
|