Traffic Lights controller using 8051 microcontroller (Easy Assembly Program)

Hello friends! In one of my previous post, I wrote on the differences between microcontroller and microprocessors. In this post I want to enter into the application part of microcontrollers. Now a day microcontrollers find their application in almost every electronics applications ranging from remote based toy cars to mobile phones, aircraft, etc.



In this post, I want to share with you, a microcontroller based mini project which I submitted as my assignment in my B.Tech course of “Microcontroller and Its Applications”. As the name of the title says, the topic is “Traffic Lights controller using 8051 microcontroller”.

Though you can find this project in almost every website on microcontrollers, I wanted to share my own program which is much smaller compared to other programs.

The general layout of the traffic lights is shown in the diagram:

Road Junction and Traffic Lights with Pin Name on them (Click to enlarge)

The green colour depicts green LED while red colour depicts red LED. The corresponding pins to which the LEDs are connected are also given beside the colour boxes.

The logic table for this project is shown below: (considering the LED will glow when pin output = 0)


Delay
P0.0
P0.1
P0.2
P0.3
P0.4
P0.5
P0.6
P0.7
1st
0
0
1
0
1
0
1
1
2nd
1
1
0
0
1
0
1
0
3rd
1
0
1
1
0
0
1
0
4th
1
0
1
0
1
1
0
0

Program:

org 0000h
here:
mov p0,#0d4h
acall delay1
mov p0,#53h
acall delay1
mov p0,#4dh
acall delay1
mov p0,#35h
acall delay1

sjmp here

delay1:
MOV R2,#42d
MOV R1,#00d
MOV R0,#00d
loop: DJNZ R0,loop
DJNZ R1,loop
DJNZ R2,loop
RET


You can watch the demo video of this project in the embedded youtube video:


Caution: Please note that, the program which I created for this program is very trivial one. Even my Professor said that this is not the efficient way of controlling traffic. So I will be working for a more efficient way of controlling traffic in future. So if you plan to submit this as any assignment then, Be careful.

Your suggestions and criticism for this program are always welcome.

3 comments:

  1. Anonymous9/15/2013

    Excuse me, I tried your program using TASM.. and it has errors, i can't resolve it. Can you please help me..?

    ReplyDelete
  2. How about you change the diagram to 4-way roundabout with traffic lights... well it just idea...
    :-P

    ReplyDelete

If you liked this blog then Join me at:
Facebook
Twitter