void USART2_ISR(void) interrupt 8 using 1
{
unsigned char redata;
unsigned char i=0;
RW485 = LOW;
if(S2CON&1)
{
var0 =0;
redata = S2BUF;
var = redata;
var += var0;
combuf[compointer++]=redata;
if((S2CON & 0x04) == P)
{
buf[0] = 0x21;
buf[1] = 0x22;
SendStr232(2);
}
S2CON&=(~1);
}
}
代码如上,串口调试助手发送1个字节正常,发送2个以上收到的是乱码
|