📄 atframe.c
字号:
Get_char2();
if(R3!='E') goto check_continue;
Get_char2();
if(R3!='R') goto check_continue;
Get_char2();
if(R3!='R') goto check_continue;
Get_char2();
if(R3!='O') goto check_continue;
Get_char2();
if(R3!='R') goto check_continue;
Get_char2();
if(R3!=':') goto check_continue;
if(!COMFG2.bits.AFrame) ATFrameFG.bits.Contin=1;
if(ATFrameFG.bits.Contin) return;
ATFrameFG.bits.CMEERR=1;
goto End_AFrame;
}
goto check_continue; //unknow
}
if(R3=='G') //+CMG...
{
Get_char2();
if(ATFrameFG.bits.Contin) return;
R2=R3;
Get_char2();
if(R3!=':') goto check_continue;
R3=R2;
if(R3=='R') //+cmgr:
{
if(!COMFG2.bits.AFrame)
{
ATFrameFG.bits.Contin=1;
return;
}
ATFrameFG.bits.cmgd=1;
Find_char2('"');
Get_char2();
if(R3=='R')
{
Get_char2(); //'E'
Get_char2(); //'C'
Get_char2(); //' '
Get_char2(); //'U' or 'R'
if(R3!='U') goto End_AFrame;
Find_char2(',');
Find_char2(',');
Find_char2(',');
Get_char2();
if(R3!='"') goto End_AFrame;
Find_char2('"');
Get_char2();
if(R3!=0x0d) goto End_AFrame;
Get_char2();
if(R3!=0x0a) goto End_AFrame;
Get_char2();
if(R3!='#') goto End_AFrame;
Get_char2();
if(R3!='#') goto End_AFrame;
Get_char2();
if(R3!='#') goto End_AFrame;
Get_char2();
if(R3!='*') goto End_AFrame;
Get_char2();
if(R3!='*') goto End_AFrame;
Get_char2();
if(R3!='*') goto End_AFrame;
Get_char2();
if(R3=='I')
{
Get_char2();
if(R3!='P') goto End_AFrame;
Get_char2();
if(R3!=':') goto End_AFrame;
Get_char2();
BFIIC[0]=R3;
Get_char2();
BFIIC[1]=R3;
Get_char2();
BFIIC[2]=R3;
Get_char2();
BFIIC[3]=R3;
Get_char2();
BFIIC[4]=R3;
Get_char2();
BFIIC[5]=R3;
Get_char2();
BFIIC[6]=R3;
Get_char2();
BFIIC[7]=R3;
Get_char2();
BFIIC[8]=R3;
Get_char2();
BFIIC[9]=R3;
Get_char2();
BFIIC[10]=R3;
Get_char2();
BFIIC[11]=R3;
Get_char2();
BFIIC[12]=R3;
Get_char2();
BFIIC[13]=R3;
Get_char2();
BFIIC[14]=R3;
Get_char2();
BFIIC[15]=R3;
Get_char2();
BFIIC[16]=R3;
Get_char2();
BFIIC[17]=R3;
Get_char2();
BFIIC[18]=R3;
Get_char2();
BFIIC[19]=R3;
Get_char2();
BFIIC[20]=R3;
if(Check_ServerIP()!=1) goto End_AFrame; //not Number
if(ATFrameFG.bits.Contin) goto End_AFrame;
Framept2.data=FrameEnd2.data;
COMFG2.bits.AFrame=0;
subah=0;
subal=AT_IPadr;
IICNUM=15;
IICMEM=BFIIC;
EEPW();
subah=0;
subal=AT_IPport;
IICNUM=5;
IICMEM=BFIIC+16;
EEPW();
SendATFG.bits.IPchange=1;
goto End_AFrame; //return; ???????
}
if(R3=='H')
{
Get_char2();
if(R3!='D') goto End_AFrame;
Get_char2();
if(R3!=':') goto End_AFrame;
Get_char2();
if(ATFrameFG.bits.Contin) goto End_AFrame;
if(R3=='1') CONFIGFG.bits.enID=1;
else if(R3=='0') CONFIGFG.bits.enID=0;
else goto End_AFrame;
subah=0;
subal=AT_CONFIGFG;
IICNUM=1;
IICMEM=&CONFIGFG.ch;
EEPW();
Get_char2();
if(R3!=',') goto End_AFrame;
for(R0=0;R0<12;R0++)
{
Get_char2();
if(ATFrameFG.bits.Contin) goto End_AFrame;
if((R3==0x0d)||(R3==0x0a)||(R3==' ')) break;
BFIIC[R0]=R3;
}
BFIIC[R0]=' ';
subah=0;
subal=AT_HeadID;
IICNUM=14;
IICMEM=BFIIC;
EEPW();
subah=0;
subal=AT_HeadID;
IICNUM=14;
IICMEM=HeadID;
EEPR();
goto End_AFrame;
}
if(R3=='T') //###***TEST:1/0,?mins //信跳测试周期
{
Get_char2();
if(R3!='E') goto End_AFrame;
Get_char2();
if(R3!='S') goto End_AFrame;
Get_char2();
if(R3!='T') goto End_AFrame;
Get_char2();
if(R3!=':') goto End_AFrame;
Get_char2();
if(ATFrameFG.bits.Contin) goto End_AFrame;
if(R3=='1') CONFIGFG.bits.enTest=1;
else if(R3=='0') CONFIGFG.bits.enTest=0;
else goto End_AFrame;
subah=0;
subal=AT_CONFIGFG;
IICNUM=1;
IICMEM=&CONFIGFG.ch;
EEPW();
Get_char2();
if(R3!=',') goto End_AFrame;
Get_char2();
CheckNum();
if(!R3) goto End_AFrame;
if(ATFrameFG.bits.Contin) goto End_AFrame;
SetMinTest=R3-0x30;
subah=0;
subal=AT_TestLong;
IICNUM=1;
IICMEM=&SetMinTest;
EEPW();
goto End_AFrame;
}
goto End_AFrame;
}
if(R3=='S')
{
Get_char2(); //'T'
Get_char2(); //'O'
Get_char2(); //' '
Get_char2(); //'U' or 'S'
if(R3!='U') goto End_AFrame;
// 此信息未发送,
ATFrameFG.bits.cmgd=0; //not clear
ATFrameFG.bits.OKend=1;
if(ATFrameFG.bits.Contin) goto End_AFrame;
goto End_AFrame;
}
goto check_continue; //unknow
}
if(R3=='W')
{
}
if(R3=='L')
{
}
goto check_continue; //unknow
}
}
}
else if(R3=='P') //+PDP: DEACT
{
Get_char2();
if(R3!='D') goto check_continue;
Get_char2();
if(R3!='P') goto check_continue;
Get_char2();
if(R3!=':') goto check_continue;
Get_char2();
if(R3!=0x20) goto check_continue;
Get_char2();
if(R3!='D') goto check_continue;
Get_char2();
if(R3!='E') goto check_continue;
Get_char2();
if(R3!='A') goto check_continue;
Get_char2();
if(R3!='C') goto check_continue;
Get_char2();
if(R3!='T') goto check_continue;
if(!COMFG2.bits.AFrame) ATFrameFG.bits.Contin=1;
if(ATFrameFG.bits.Contin) return;
WorkFG.bits.Online=0;
// SIG_Lap=1; //由终端完成闪烁显示
Connecting=1;
goto End_AFrame;
}
else if(R3=='S') //+SCKS: 0
{
Get_char2();
if(R3!='C') goto check_continue;
Get_char2();
if(R3!='K') goto check_continue;
Get_char2();
if(R3!='S') goto check_continue;
Get_char2();
if(R3!=':') goto check_continue;
Get_char2();
if(R3!=0x20) goto check_continue;
Get_char2();
if(R3!='0') goto check_continue;
if(!COMFG2.bits.AFrame) ATFrameFG.bits.Contin=1;
if(ATFrameFG.bits.Contin) return;
WorkFG.bits.NoSIM=1;
goto End_AFrame;
}
goto check_continue; //不能识别
}
if(R3=='2') //RING
{
Get_char2();
if(R3!=0x0d) goto check_continue;
if(!COMFG2.bits.AFrame) ATFrameFG.bits.Contin=1;
if(ATFrameFG.bits.Contin) return;
WorkFG.bits.Ring=1;
goto End_AFrame;
}
if(R3=='0')
{
Get_char2();
if(R3!=0x0d) goto check_continue;
ATFrameFG.bits.OKend=1;
if(FrameEnd2.data==temp4.Uint) goto End_AFrame;
Framept2.pt=temp4.Uchp;
return;
}
if(R3=='4')
{
Get_char2();
if(R3!=0x0d) goto check_continue;
ATFrameFG.bits.ERRend=1;
if(FrameEnd2.data==temp4.Uint) goto End_AFrame;
Framept2.pt=temp4.Uchp;
return;
}
if(R3==0x0D)
{
Get_char2();
if(ATFrameFG.bits.Contin) return;
if(R3==0x0a)
{
Framept2.pt=temp4.Uchp;
goto ATframe1;
}
}
check_continue:
if(ATFrameFG.bits.Contin) return;
ATFrameFG.bits.unknow=1;
if(!COMFG2.bits.AFrame)
{
Framept2.pt=temp4.Uchp;
return;
}
End_AFrame:
Framept2.data=FrameEnd2.data;
COMFG2.bits.AFrame=0;
return;
}
void Find_char2(unsigned char ch)
{
unsigned char i;
i=50;
while(--i)
{
Get_char2();
if(ATFrameFG.bits.Contin) break;
if(R3==ch) break;
}
}
unsigned char Wait300d_2(void)
{
// COMFG2.bits.RXING=0;
// RXOVERTMR2=0;
// COMFG2.bits.AFrame=0;
if(WaitFrame2()!=1)
return(0);
if(RXpt2.data==Framept2.data)
return(0);
Framept2.data=FrameEnd2.data;
COMFG2.bits.AFrame=0;
if((*((unsigned int *)(Framept2.pt-2)))!=0x0d30)
return(0);
return(1);
}
unsigned char WaitFrame2(void)
{
temp2.Uint=1000;
while(temp2.Uint--)
{
DelayXms(1);
if(COMFG2.bits.RXING) temp2.Uint=100;
if(COMFG2.bits.AFrame||COMFG2.bits.FramErr) return(1);
}
return(0);
}
unsigned int PTinc2(unsigned int pt)
{
if(++pt>=COMBUF2_end) return(COMBUF2_st);
return(pt);
}
unsigned int PTdec2(unsigned int pt)
{
if(--pt<COMBUF2_st) return(COMBUF2_end-1);
return(pt);
}
unsigned int PTinc1(unsigned int pt)
{
if(++pt>=COMBUF1_end) return(COMBUF1_st);
return(pt);
}
unsigned int PTdec1(unsigned int pt)
{
if(--pt<COMBUF1_st) return(COMBUF1_end-1);
return(pt);
}
//input temp4.uchp
//output R3=*(temp4.uchp++)
void Get_char2(void)
{
R3=*temp4.Uchp;
if(temp4.Uint==RXptbak.data)
{
ATFrameFG.bits.Contin=1;
return;
}
temp4.Uint=PTinc2(temp4.Uint);
}
//input temp4.uchp
//output R3=*(temp4.uchp++)
void Get_char1(void)
{
R3=*temp4.Uchp;
if(temp4.Uint==RXptbak.data)
{
SFrameFG.bits.Contin=1;
return;
}
temp4.Uint=PTinc1(temp4.Uint);
}
//ret temp3.Uint
void Get_Lenth2(unsigned char Maxbit)
{
temp3.Uint=0;
while(Maxbit--)
{
Get_char2();
R3-=0x30;
if(R3>=0x0a)
{
temp4.Uint=PTdec2(temp4.Uint);
return;
}
temp3.Uint=temp3.Uint*10+R3;
}
}
void Get_Lenth1(unsigned char Maxbit)
{
temp3.Uint=0;
if(SFrameFG.bits.Contin) return;
while(Maxbit--)
{
Get_char1();
R3-=0x30;
if((R3>=0x0a)||SFrameFG.bits.Contin)
{
SFrameFG.bits.Contin=0;
temp4.Uint=PTdec1(temp4.Uint);
return;
}
temp3.Uint=temp3.Uint*10+R3;
}
}
void CheckNum(void)
{
if(R3>=0x3a||R3<0x30) R3=0;
}
unsigned char HEX1BCD1(unsigned char hex1)
{
unsigned char bcd1;
while(hex1>=100) hex1-=100;
bcd1=(hex1/10);
return( bcd1*0x10+(hex1-bcd1*10) );
}
void CheckMS(void)
{
if(!WorkFG.bits.TestMS) return;
temp1.Uint=0x3030;
for(R0=1;R0<=15;R0++) ////care for R0!!!!!
{
if(++temp1.Uchar[0]>0x39)
{
temp1.Uchar[0]=0x30;
temp1.Uchar[1]++;
}
ATcmgr();
if(!WaitFrame2()) WaitFrame2();
// while(!WaitFrame2()) Nop();
ATframe();
if(ATFrameFG.bits.CMEERR) return;
if(ATFrameFG.bits.cmgd)
{
ATcmgd();
if(!WaitFrame2()) WaitFrame2();
// while(!WaitFrame2()) Nop();
ResetCOMBUF2();
}
// else if(!ATFrameFG.bits.OKend)
// {
// WorkFG.bits.TestMS=1;
// return;
// Nop();
// }
}
WorkFG.bits.TestMS=0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -