STM32 串口配置 注意事项

来源:互联网 发布:网络推广人员提成方案 编辑:程序博客网 时间:2024/05/15 08:35

 USART_InitStructure.USART_BaudRate = 9600;


 USART_InitStructure.USART_WordLength = USART_WordLength_9b;  //此处在有奇偶校验时需要9个数据位,无奇偶校验时8个数据位


 USART_InitStructure.USART_StopBits = USART_StopBits_1;


 USART_InitStructure.USART_Parity = USART_Parity_Even;//偶校验


 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;


 USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; 


 USART_Init(USART1,&USART_InitStructure);
0 0
原创粉丝点击