我用的串口查询方式,接收一个字节的是对的,但是接收字符串的时候,就是接收一个数组里两个以上的数据的时候就会出乱序,乱七八糟的 #include "stm32f10x_lib.h" #include "config.h" #include "debug.h" #include "ili9320.h" u8 rec1[2]; u8 AsciiBuff[5]; void display(void) { HexToASCII(); WriteString16(60,150,AsciiBuff,Blue); } void HexToASCII(void) { AsciiBuff[0] = rec1[0]/10+0x30; AsciiBuff[1] = rec1[0]%10+0x30; AsciiBuff[2] = rec1[1]/10+0x30; AsciiBuff[3] = rec1[1]%10+0x30; AsciiBuff[4] = 0; } unsigned char USART_receivedata(void) { unsigned char rec; if(USART_GetFlagStatus(USART2,USART_IT_RXNE)==SET) //检查制定的USART,接收中断标志位设置与否 { rec = USART_ReceiveData(USART2); //从COM0读取数 } return rec; } void recieve(void) { unsigned char i; for(i=0;i |
RE:stm32串口接收字符串的问题
RE:stm32串口接收字符串的问题