|
以下代码是否正确,请指点,谢谢!
void __irq OnUerr01Interrupt()
{
unsigned char ch;
unsigned int ec;
ec = rUERSTAT0;
/* channel 0*/
if (ec != 0)
{
if ((ec&0x8)!= 0)
{
UART_sendString(UART_CH0, "\nUART0: BREAK signal.\n");
}
else if ((ec&0x4)!= 0)
{
UART_sendString(UART_CH0, "\nUART0: Frame error.\n");
}
else if ((ec&0x2)!= 0)
{
UART_sendString(UART_CH0, "\nUART0: Parity error.\n");
}
else if ((ec&0x1)!= 0)
{
UART_sendString(UART_CH0, "UART0: Over run error.");
}
ch = RdURXH0();
}
/* channel 1*/
ec = rUERSTAT1;
if (ec != 0)
{
if ((rUERSTAT1&0x8)!= 0)
{
UART_sendString(UART_CH0, "\nUART1: BREAK signal.\n");
}
else if ((rUERSTAT1&0x4)!= 0)
{
UART_sendString(UART_CH0, "\nUART1: Frame error.\n");
}
else if ((rUERSTAT1&0x2)!= 0)
{
UART_sendString(UART_CH0, "\nUART1: Parity error.\n");
}
else if ((rUERSTAT1&0x1)!= 0)
{
UART_sendString(UART_CH0, "UART1: Over run error.");
}
ch = RdURXH0();
}
rI_ISPC = BIT_UERR01;
} |
|