STM32 串口配置 注意事项

 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);

你可能感兴趣的:(MCU)