/*
USART 1 装备
假如需求运用奇数校验或许偶数校验,需求把数据长度定位9bit
*/
USART_InitStructure.USART_BaudRate = COM1BAUD;
USART_InitStructure.USART_WordLength =USART_WordLength_9b;
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;
STM_EVAL_COMInit(COM1, &USART_InitStructure);
/*使能USART1的接纳中止*/
USART_ITConfig(USART1,USART_IT_RXNE,ENABLE);
看了数据手册,仍是不太理解为啥要把数据长度定位9,
莫非 奇偶校验位也是数据的一部分,无便是 0 +8 = 8,
而有校验便是1+8 = 9
或许只能这样理解了。