{
}
首先中断的配置
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
#ifdef
#else
#endif
}
接着设置GPIO的第二功能
void GPIO_Configuration(void)
{
}
初始化串口
void USART_Configuration(void)
{
#if 1
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable;
USART_ClockInit(USART1, &USART_ClockInitStructure);
#endif
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART1, &USART_InitStructure);
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
}
然后是中断处理函数,这里只实现了简单的将收到的字符回显到终端上
void USART1_IRQHandler(void)
{
}
上一篇:STM32 IAR工程->Keil MDK转换详解
下一篇:arm-linux-gcc和arm-elf-gcc 区别
推荐阅读最新更新时间:2024-03-16 14:52