好的,以下是使用标准库stm32f10x.h编写的stm32f103c8t6通过USART2串口输出数值的程序:
#include "stm32f10x.h"
int main(void)
{
// 使能 GPIOA 和 USART2 的时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB1Periph_USART2, ENABLE);
// 配置 PA2 引脚为复用推挽输出,用于 USART2 的 Tx
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_Init