The project supports the development of reliable and optimal control structures for urban traffic.The intelligent and cooperative set-up of actuation and its linkage to the central control system is vital for avoiding traffic jams and accidents.four traffic signal is installed across the road as shown in figure.code is designed with the help of at89c51 controller controlling the timimg of signal so as to manage traffic effectively.
Typically traffic lights consist of a set of three colored lights: red, orange and green. In a typical cycle,
· green light allows traffic to proceed in the direction denoted,
· orange light denoting, if safe to do so, prepare to stop
· red signal prohibits any traffic from proceeding.
PROTEUS DESIGN
CODE
#include<reg51.h>
void delay(unsigned int);
sbit G2 = P1^1;
sbit Y2 = P1^2;
sbit R2 = P1^3;
sbit G1 = P2^4;
sbit Y1 = P2^5;
sbit R1 = P2^6;
sbit Y3 = P2^2;
sbit R3 = P2^3;
sbit G3 = P2^1;
sbit G4 = P3^1;
sbit Y4 = P3^2;
sbit R4 = P3^3;
void main(void)
{
while(1)
{
G1 = 0;
Y1 = 1;
R1 = 1;
G2 = 1;
Y2 = 1;
R2 = 0;
G3 = 1;
Y3 = 1;
R3 = 0;
G4 = 1;
Y4 = 1;
R4 = 0;
delay(500);
G1 = 1;
Y1 = 0;
R1 = 1;
G2 = 1;
Y2 = 0;
R2 = 1;
G3 = 1;
Y3 = 1;
R3 = 0;
G4 = 1;
Y4 = 1;
R4 = 0;
delay(500);
G1 = 1;
Y1 = 1;
R1 = 0;
G2 = 0;
Y2 = 1;
R2 = 1;
G3 = 1;
Y3 = 1;
R3 = 0;
G4 = 1;
Y4 = 1;
R4 = 0;
delay(500);
G1 = 1;
Y1 = 1;
R1 = 0;
G2 = 1;
Y2 = 0;
R2 = 1;
G3 = 1;
Y3 = 0;
R3 = 1;
G4 = 1;
Y4 = 1;
R4 = 0;
delay(500);
G1 = 1;
Y1 = 1;
R1 = 0;
G2 = 1;
Y2 = 1;
R2 = 0;
G3 = 0;
Y3 = 1;
R3 = 1;
G4 = 1;
Y4 = 1;
R4 = 0;
delay(500);
G1 = 1;
Y1 = 1;
R1 = 0;
G2 = 1;
Y2 = 1;
R2 = 0;
G3 = 1;
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