INT32S uartgetc(UART_HANDLER port) { INT32S st; if(port->recnull) { st=-1; } else { st=port->recfifo[port->rechead]; port->rechead++; port->rechead%=UART_FIFO_SIZE; port->recfull=0; if(port->rechead==port->recend) { port->recnull=1; } } return st; }
-1也就是0xff,如果接收到0xff是不是就会出错?! |