systemjnitial(void)
{
TMOD=0x21;
PCON=0x00;
SCON=0x58;
ES=1 ;
PS=1;
TH1=0x0E8;
TL1=Ox0E8;
TRl=1;
EA=1;
}
//68H Address Control DataLen Datal Data2…DataN SumCheck 16H
corn isp(void) interrupt 4 using 3
{
if(RI)
{
RI=0;
if(b-validFrame)
{
return;
}
if(m-frameStatus==0x00)
{
if(SBUF!=0x68)
{
m-frameStatus=0x00;
}
else
{
m-frameStatus=0x01;
}
}
else if(m-frameStatus=0x01)
{
m-addrCode=SBUF;
m-frameStatus=0x02;
m-sysCheckData=0x00;
}
else if(mLframeStatus==0x02)
{
m-controlCode=SBUF;
m-frameStatus=0x03;
m-sysCheckData+=m-controlCode;
}
else if(m-frameStatus=== 0x03)
{
m-dataLen=SBUF;
m-fxameStatus=0x04;
m-sysCheckData+=rn-dataLen;
m-dataFieldCount=0x00;
}
else if(m-frameStatus~0x04)
{
m-dataBuffer[m-dataFieldCount]=SBUF;
m-sysCheckData+=m-dataBuffer[m-dataFieldCount];
m-dataFieldCount#;
if(m-dataFieldCount==m-dataLen)
{
m-frameStatus=0x05;
}
}
else if(m-frameStatus==0x05)
{
m-checkData=SBUF;
if(m-sysCheckData != m-checkData)
{
m-fcameStatus=0x00;
}
else
{
m-frameStatus=0x06;
}
}
else if(m-frameStatus=0x06)
{
m-frameEnd=SBUFs
if(m-frameEnd!=0x16)
{
b-validFrame=0;
}
else
{
b-validFratne=1;
}
m-frameStatus=0x00;
}
}