Semester Project -Traffic Light Control There are many applications for controll
ID: 2291099 • Letter: S
Question
Semester Project -Traffic Light Control There are many applications for controller circuits. One of them is a highway intersection traffic light. In this project you will design and implement a 4-way traffic light controller that uses pressure activated sensors embedded into the roadway to determine the sequence of light changes used to optimize the flow of traffic. System requirements The system has 2 inputs sensors and 6 output lights. Inputs sensors - are devices embedded into the roadway and they are capable of detecting if a vehicle is over them. They output a logic 0 when no vehicle is above and logic 1 otherwise. There are two sets of sensors, and they are North South road vehicle sensor East West road vehicle sensor Output lights These lights are part of the traffic light assembly. Each light assembly contains three light colored red, yellow and green, which are used to indicate stop attention and go respectively North South road red light North South road yellow light North South road green light East West road red light East West road yellow light East West road green light Details about the design . The traffic light cycle is shown in the diagram given below: North South cycle East West cycle NS tratic 0 1 2 3 4 567 89 10 11 12 13 4 15 0 123 4 5 6 78 9 10 11 12 13 14 15 EW traffic Diagram 1 Traffic flow diagramExplanation / Answer
ANSWER:
Source Code
Using 8501 C Program to Traffic Light
#include <reg51.h>
sbit RED1 = P1^0;
sbit YELLOW1 = P1^1;
sbit GREEN1 = P1^2;
sbit RED2 = P3^2;
sbit YELLOW2 = P3^3;
sbit GREEN2 = P3^4;
sbit RED3 = P3^5;
sbit YELLOW3 = P3^6;
sbit GREEN3 = P3^7;
sbit RED4 = P1^3;
sbit YELLOW4 = P1^4;
sbit GREEN4 = P1^;5
void Delay (void)
{
unsigned int i, j;
for (i=0; i<300; i++)
for (j=0; j<700; j++);
}
void Super Delay ( )
{
unsigned int i ;
for (i=0 ; i<30; i++)
Delay( );
}
void main ( )
{
PD = 0;
while (1)
{
R1 = 0; G1 = 1; Y1 = 0; / Understand RED1 is written as R1 and so on through my program.
R2 = 1; G2 = 0; Y2 = 0;
R3 = 1; G3 = 0; Y3 = 0;
r4 = 1; G4 = 0; Y4 = 0;
SuperDelay () ;
G1 = 0; Y1 = 1;
Delay ( ) ;
R1 = 1; G1 = 0; Y1 = 0;
R2 = 0; G2 = 1; Y2 = 0;
R3 = 1; G3 = 0; Y3 = 0;
r4 = 1; G4 = 0; Y4 = 0;
SuperDelay ( ) ;
G2 = 0; Y2 = 1;
Delay ( ) ;
R1 = 1; G1 = 0; Y1 = 0;
R2 = 1; G2 = 0; Y2 = 0;
R3 = 0; G3 = 1; Y3 = 0;
r4 = 1; G4 = 0; Y4 = 0;
SuperDelay ( ) ;
G3 = 0; Y3 = 1;
Delay();
R1 = 1; G1 = 0; Y1 = 0;
R2 = 1; G2 = 0; Y2 = 0;
R3 = 1; G3 = 0; Y3 = 0;
r4 = 0; G4 = 1; Y4 = 0;
SuperDelay ( ) ;
G4 = 0; Y4 = 1;
Delay ( ) ;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.