Home > other >  AT89C51 intersection traffic lights program things 35 s, 30 s direction crossing the red light green
AT89C51 intersection traffic lights program things 35 s, 30 s direction crossing the red light green

Time:09-17

# include
Sbit NBL=P1 ^ 0;
Sbit NBY P1=^ 1;
Sbit NBH=p ^ 2;
Sbit DXL P1=^ 3;
Sbit knocking=P1 ^ 4;
Sbit DXH=P1 ^ 5;
Unsigned int a;
Void DJS ()
{

A=60000;
While (a -);

}
Void main ()
{

P1=0;
While (1)

{
P1=0 x21;//00100001//NBL=1;//1.0
//DXH=1;//1.5
DJS ();
DJS ();
DJS ();
DXH=0;
NBL=1;
Against a=1;
A=40000;
While (a -);
Against a=0;
DXL=1;
NBL=0;
NBH=1;
DJS ();
DJS ();
DJS ();
DXL=1;
NBH=0;
NBY=1;
A=40000;
While (a -);
DXL=0;
NBY=0;

}

}
  • Related