while(answer(3));
do
{
for(i=0;i<10;i++)
{
SBUF=p=send;
while(TI==0);
TI=0;
}
}
while(answer(10));
do
{
for(i=0;i<11;i++)
{
SBUF=p=array;
while(TI==0);
TI=0;
}
}
while(responses(11));
for(i=0;i<58;i++)
{
SBUF=p=sdk;
while(TI==0);
TI=0;
}
while(1);
}
///////////////////////////////////
bit answer(unsigned char r)
{
unsigned char k,checksum,answer[2];
bit checksum_flag=1;
for(k=0;k<r+2;k++)
{
while(RI==0);
RI=0;
RB8=0;
}
for(k=0;k<2;k++)
{
while(RI==0);
RI=0;
RB8=0;
answer[k]=SBUF;
}
checksum=answer[0]+answer[1];
if(checksum==0x9a)
checksum_flag=0;
return checksum_flag;
}
///////////////////////////////
bit responses(unsigned char r)
{
unsigned char k,checksum,answer[2];
bit checksum_flag=1;
for(k=0;k<r+2;k++)
{
while(RI==0);
RI=0;
RB8=0;
}
for(k=0;k<2;k++)
{
while(RI==0);
RI=0;
RB8=0;
answer[k]=SBUF;
}
checksum=answer[0]+answer[1];
if(checksum==0x5e)
checksum_flag=0;
return checksum_flag;
}
有谁知道这部分程序是怎样运行的
|