?? ints.c
字號:
//Serial interrupt.
#include <SST89V564.H>
#include "ext_temp.h"
void receive(void) interrupt 4 using 2 /*Receive interrupt*/
{
unsigned char rev; //One byte for receive buffer.
if (RI==1)
{
RI=0;
rev=SBUF;
if (IAP==0)
{
if (moto_fg ==0)
{if (count==0x00) //Whether the first byte is $.
{
if (rev=='$')
{rdata[count++]=rev;}
}
else if (count==0x01)//Whether the second byte is B.
{
if ((rev=='B')||(rev=='b'))
{rdata[count++]=rev;}
else
{count=0x00;}
}
else if (count==0x02)//Whether the second byte is D.
{
if ((rev=='D')||(rev=='d'))
{rdata[count++]=rev;}
else
{count=0x00;}
}
else if (count>=127)
{count = 0;}
else
{
rdata[count++]=SBUF;
if (rdata[count-1]== 0x0a) //Receive data.
{
RXLen = count;
count = 0;
flagserial=1;
}
}
}
else
{
if (count ==0x00)
{
if (rev =='@')
rdata[count++]=rev;
}
else if (count ==0x01)
{
if (rev =='@')
rdata[count++]=rev;
else
count =0;
}
else if (count >128)
count =0;
else
{
rdata[count++]=rev;
if ((rdata[count-2]== 0x0d)&&(rdata[count-1]== 0x0a)) //Receive data.
{
RXLen = count;
count = 0;
flagserial=1;
}
}
}
}
else
{
if (count==0x00)
{
if (rev==0x80)
{count++;}
}
else if (count==0x01)
{
if (rev==0xe0)
{count++;}
else
{count=0x00;}
}
else if (count==0x02)
{
if (rev==0xf8)
{count++;}
else
{count=0x00;}
}
else if (count==0x03)
{
if (rev==0xfe)
{RunIAP=1;count=0x00;}
else
{count=0x00;}
}
}
}
if (TI&&!moto_fg)//ASCII
{
TI = 0;
if (TXCont < TXLen)
{SBUF = sdata[TXCont++];}
}
//else if (TI&&moto_fg) //motonola binary
// {
// TI = 0;
// }
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -