发表于:2020/10/17 10:11:11
#0楼
void serial () interrupt 4 using 3
{
if(RI)
{
unsigned char ch;
RI=0;
ch=SBUF;
if (ch>127)
{
count3=0;
inbuf1[count3]=ch;
checksum=ch-128;
}
else
{
count3++;
inbuf1[count3]=ch;
checksum^=ch;
if ((count3==(INBUF_LEN-1))&&(!checksum))
{
read_flag=1;
}
}
}
}
{
if(RI)
{
unsigned char ch;
RI=0;
ch=SBUF;
if (ch>127)
{
count3=0;
inbuf1[count3]=ch;
checksum=ch-128;
}
else
{
count3++;
inbuf1[count3]=ch;
checksum^=ch;
if ((count3==(INBUF_LEN-1))&&(!checksum))
{
read_flag=1;
}
}
}
}