void dongruan_check(unsigned char road)
{ unsigned char i;
unsigned char err=0;
for(i=0;i<60;i++)
{send_cmd=Cmd[3+road];
}
for(i=0;i<6;i++)
{send_cmd[9+i]=addr;
}
_EINT();
for(i=0;i<3;i++)
{
uart0_send(Cmd[3+road]); //抄表
time_start();
time_out=0;
while((RCV_Flag!=0xff)&&(time_out!=60));
time_stop();
// Judge_Cmd();
// if(Which_Cmd==4+road)
RCV_Flag=0x00;
if((RCV_Byte[1]==0x30)&&(RCV_Byte[34]==0x91))
{err=0xff;
for(i=0;i<50;i++)
{RCV_Byte=0;
}
break;}
if(i==2) err=5;
}
// }
if(err==0xff){reslut_lcd|=(1<<(road*2+1)); reslut_lcd&=~(1<<(road*2)); } //哪路亮绿灯
else {reslut_lcd&=~(1<<(road*2+1)); reslut_lcd|=(1<<(road*2)); } //哪路亮红灯
}
我要修改通讯次数。上面车=的是第一次串口通讯失败后,再通讯3次就亮红灯(595接双色管)。现我需要修改成第一次串口通讯失败后就亮红灯。 |