下面就是读取FIFO中所有数据的方法:
// read all the data in FIFO once. Then there is no too much interruptions
if ((U0IIR & 0xF) == 0x0C)
{
add_data_num = 0;
while (U0LSR & 0x00000001)// Read UART's LSR register first, and determine whether FIFO is empty or not
{
add_data = 1; rcv_byte[add_data_num] = U0RBR;
add_data_num++;
}
}
|