文档中有个关键的错误~~~肯定是不行的~~~
以下是串口查询等待的例程,如果是用中断+FIFO或DMA,会是什么样呢???
LPC_INT8U HDQReadWriteByte (LPC_INT8U data) { LPC_INT8U i, ch; LPC_INT8U value = 0; for (i = 0; i < 8; i ++) { if (data & 1) { UART_PutCharByPolling(UART1, 0xfe);//1 } else { UART_PutCharByPolling(UART1, 0xc0);//0 } ch = UART_GetCharByPolling(UART1); data >>= 1; value >>= 1; if (ch > 0xf8) { value |= 0x80; } } return value; }
//.... data = HDQReadWriteData(0x1c);//读系列号 |