Taffic Light Control System Using 8051

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

TRAFFIC LIGHT CONTROL SYSTEM

USING 8051 MICROCONTROLLER


PRESENTED BY:
RAJAT KUMAR PRADHAN
19111045
INTRODUCTION

Roads are an important way of transportation for us. So therefore serious


traffic jams can cause major issues like wastage of working hours, extra fuel
consumption and road accidents in densely populated cities around the world.
So traffic management has become very important these days. In this we will
see how we can develop a Traffic Light Control System using 8051
Microcontroller and how we can solve this problem.
CIRCUIT DIAGRAM
WORKING
ALGORITHM
PROGRAM

org 0000h clr p0.1; yellow led on indicating red will turn off in sometime

ljmp start lcall delayfor5; delay for yellow led

setb p0.0; off the red led

setb p0.1; off yellow led

org 0200h clr p0.2; turn on green led

lcall delayfor10; delay for 10sec


start: clr p0.0; set red led
clr p0.1; turn on yellow led for indicating the green will turn off
setb p0.1; off yellow
lcall delayfor5; delay for 5 sec
setb p0.2; off green
sjmp start; again repeat the same process
lcall delayfor10; generate a delay of 10 sec
PROGRAM (CONT.)

org 1500h org 1700h

delayfor10: mov tmod, #01h; initialize the timer delayfor5: mov tmod, #01h; initialize the timer

mov r0, #152; mov r0, #76;

back: mov tl0, #00h; back1: mov tl0, #00h;

mov th0, #00h; mov th0, #00h;

setb tr0; setb tr0;

check: jnb tf0, check; 66ms (66ms * 152 = 10 sec) check1: jnb tf0, check1

clr tf0; clr tf0;

clr tr0; clr tr0;

djnz r0, back djnz r0, back1; we are able to generate the required delay

ret; ret;

end;
DELAY GENERATION

GATE C/T M1 M0 GATE C/T M1 M0


0 0 0 0 0 0 0 1

For Timer 0 Mode 1 (for maximum size of 16 bits) we set TMOD = 01H 10 s / 66 ms = 152
5 s / 66 ms = 76
Crystal Frequency = 11.0592 MHz
Timer Frequency = 11.0592 MHz / 12 = 921.6 KHz
T = 1/F
T = 1/921.6 KHz
T = 1.085 us

Maximum possible values in timer registers when Mode 1 (16 bits) = 2^16 = 65535
65535 * 1.085 us = 66 ms
The maximum delay we can produce using Timer 0 Mode 1 is 66 ms.
ADVANCED MODIFICATIONS

The Traffic Light Control System can


be improved and made more dynamic
by adding a 7-Segment Display along
with it which will show the remaining
time until the red light changes to
green light and vice versa.
THANK YOU!

You might also like