STM32中ADC的使用/printf函数重定向串口显示内部温度传感器测量值


STM32F334C8T6这款MCU中有两个12位ADC(模数转换器),ADC1的通道16连接到内置的一个温度传感器,本文使用该温度传感器测量MCU和周围的环境温度,并且通过串口发送到PC的串口助手进行显示。

1. ADC的使用

1. select the ADC clock using the function RCC_ADCCLKConfig()
2. Enable the ADC interface clock using RCC_AHBPeriphClockCmd();
3. ADC pins configuration
 Enable the clock for the ADC GPIOs using the following function: RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOx, ENABLE);
 Configure these ADC pins in analog mode using GPIO_Init();
4. Configure the ADC conversion resolution, data alignment, external trigger and edge, 
sequencer lenght and Enable/Disable the continuous mode using the ADC_Init() function.
5. Activate the ADC peripheral using ADC_Cmd() function.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值