0% found this document useful (0 votes)
16 views

3.traffic Light Interfacing

Practical

Uploaded by

tejassc23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

3.traffic Light Interfacing

Practical

Uploaded by

tejassc23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

S.Y.B.Sc.

(CS)
Electronics Practical Manual
Traffic Light Controller Using 8051 microcontroller

Title: Traffic Light Controller Using 8051 microcontroller


Aim: To study traffic light controller using 8051 microcontroller.
Objectives:
1. To understand the concept of Traffic light controller.
2. To study interfacing of Traffic light controller to 8051.
3. To study Keil uVision IDE software.
Apparatus: 8051 trainer kit, Willar Progranmmer, Connecting wires, etc.
Software Used: Keil uVision IDE, WLPRO.
Circuit Diagram:

Procedure:
1) Connect 12V DC power adaptor to the 8051 Target board.
2) Start Keil IDE and follow the steps mention in the “Steps to use of Keil
IDE software”.
3) Set the Mode_Sel slide switch in the “8051 section” on “Pgm” mode.
4) Compile the written program, if there are no errors connect the PC to the
programmer placed on the 8051 Target board; by using USB cable.
5) Follow the procedure mention in the “Steps to use of WLPRO software”.
Upload the program.
6) Make necessary connections as shown in the circuit diagram.
7) Set the Mode_Sel slide switch in the “8051 section” on “Run” mode.
8) Observe the output.
Algorithm:

1. Initialization:

 Define pin configurations for controlling traffic lights (north, south, west,
east).
 Set up a delay function to introduce timing.

2. Main Loop (Repeat indefinitely):

 Generate Sequence for North Green Light:

(Turn ON only on North and Turn ON only Red for remaining direction)

 Call delay function for 15 seconds.


 Generate Sequence for South Green Light:

(Turn ON only Green on South and Turn ON only Red for remaining
direction)

 Call delay function for 15 seconds.


 Generate Sequence for West Green Light:

(Turn ON only Green on West and Turn ON only Red for remaining
direction)

 Call delay function for 15 seconds.


 Generate Sequence for East Green Light:

(Turn ON only Green on East and Turn ON only Red for remaining direction)

 Call delay function for 15 seconds.

3. Repeat from step 2.

Program:
#include<reg51.h>
sbit rn=P3^0;
sbit yn=P3^1;
sbit rs=P3^2;
sbit ys=P3^3;
sbit rw=P3^4;
sbit yw=P3^5;
sbit re=P3^6;
sbit ye=P3^7;
sbit gn=P2^0;
sbit gs=P2^1;
sbit gw=P2^2;
sbit ge=P2^3;
void delay()
{
long int i;
for(i=0;i<=50000;i++); //3 sec
}
void main()
{
while (1)
{
//north
rn=1;rs=0;rw=0; re=0;
gn=0;gs=1;gw=1;ge=1;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
//south
rn=0;rs=1;rw=0; re=0;
gn=1;gs=0;gw=1;ge=1;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
//west
rn=0;rs=0;rw=1; re=0;
gn=1;gs=1;gw=0;ge=1;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
//east
rn=0;rs=0;rw=0; re=1;
gn=1;gs=1;gw=1;ge=0;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
}
}

Result: : Interfacing of Traffic light controller with 8051 is successfully studied,


tested and observe the output.

You might also like