if(RC1IF)
{ //已接收字节
ferr1bit = FERR1;
*bMode = RX9D1;
*byte = RCREG1;
if(ferr1bit)//帧错误
{
*bMode = 0;
*byte = 0;
sta = 0;
ferr1bit = 0;
}
else
sta = 1;
if(RC1IF)
{
*bMode = RX9D1; //返回方式位
*byte = RCREG1; //返回字节值
}
if(OERR1)
{ //帧溢出,重启模块
CREN1 = 0;
CREN1 = 1;
sta = 0;
}
}
大伙帮我看看,这我18F系列串口出现帧错误或帧溢出时我的处理方式!看是否正确实用!欢迎指正~ |