串口读写时遇到一个很奇怪的问题
第一段代码没有问题,发送一个字符,回馈一个字符:
if(rUTRSTAT0 & 0x1) c = (unsigned char)rURXH0; while(rUTRSTAT0 & 0x4 == 0); rUTXH0 = c; }
while(rUTRSTAT0 & 0x1 == 0); c = (unsigned char)rURXH0; while(rUTRSTAT0 & 0x4 == 0); rUTXH0 = c;
if(rUTRSTAT0 & 0x1 == 0) continue; c = (unsigned char)rURXH0; while(rUTRSTAT0 & 0x4 == 0); rUTXH0 = c;