|
USART_InitStructure.USART_BaudRate = 9600; 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; USART_InitStructure.USART_Clock = USART_Clock_Disable; USART_InitStructure.USART_CPOL = USART_CPOL_Low; USART_InitStructure.USART_CPHA = USART_CPHA_2Edge; USART_InitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(USART1, &USART_InitStructure); USART_Cmd(USART1, ENABLE); while(1) { TxCounter=0; while(TxCounter < TxBufferSize) { USART_SendData(USART1, TxBuffer[TxCounter]); TxCounter++;
/* Loop until the end of transmit */ while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) { } } 为什么运行第一次的话就少第一个数,后面就可以了,不明白问题出哪了,帮忙看看啊。在串口调试工具上查看的。u8 TxBuffer[] ="10212023302"; 收到的结果:30 32 31 32 30 32 33 33 30 32 00 单步的时候正常,全速就少第一个数
|
|