用STM32的UART功能发送0x33,用电脑里的串口助手接收数据,是00 66。。。这中间应该是某个地方上,单片机和串口助手的通信有差别造成的吧。但是自己一直没想明白其中的原因。还望同志们不吝赐教!!谢啦
附上UART的设置:
UART2_DeInit();
/* UART1 configured as follow:
- BaudRate = 9600 baud
- Word Length = 8 Bits
- One Stop Bit
- No parity
- Receive and Transmit enabled
- UART1 Clock disabled
*/
UART2_Init((uint32_t)9600, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO,UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE);
UART2_Cmd(ENABLE);
UART2_SendData8(0x33);
while (UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET)
{
} |