How to Interface Traffic Light with 8051

Traffic Light Control Interfacing with 8051 Primer

Tags: traffic light controller using 8051,traffic light controller demo, 8015 traffic light controller source code, Circuit Diagram to Interface Traffic Light with 8051, C Program to interface Traffic Light using 8051,
Overall rating
traffic-light-8051
8051 Primer Board

The 8051 Primer board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through serial port.


NXP’s 8051 (AT89V51RD2), 8051 Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 8-bit Microcontrollers.


Traffic Light Control

Traffic lights, which may also be known as stoplights, traffic lamps, traffic signals, signal lights, robots or semaphore, are signaling devices positioned at road intersections, pedestrian crossings and other locations to control competing flows of traffic.


About the colors of Traffic Light Control

Traffic lights alternate the right of way of road users by displaying lights of a standard color (red, yellow/amber, and green), using a universal color code (and a precise sequence to enable comprehension by those who are color blind).


In the typical sequence of colored lights:


  • Illumination of the green light allows traffic to proceed in the direction denoted,
  • Illumination of the yellow/amber light denoting, if safe to do so, prepare to stop short of the intersection, and
  • Illumination of the red signal prohibits any traffic from proceeding.

Usually, the red light contains some orange in its hue, and the green light contains some blue, for the benefit of people with red-green color blindness, and "green" lights in many areas are in fact blue lenses on a yellow light (which together appear green).


Interfacing Traffic Light with 8051

The Traffic light controller section consists of 12 Nos. point LEDS are arranged by 4Lanes in 8051 Primer Board. Each lane has Go (Green), Listen (Yellow) and Stop (Red) LED is being placed.


Pin Assignment with 8051

 


LAN Direction

8051 Lines

LED’s

Traffic Light Controller

NORTH

P3.2

D8-Stop

 traffic-light-controller-card

 

P3.3

D9-Listen

P3.4

D10-Go

WEST

P3.5

D11-Stop

P3.6

D12-Listen

P3.7

D13-Go

SOUTH

P1.0

D14-Stop

P1.1

D15-Listen

P1.2

D16-Go

EAST

P1.3

D17-Stop

P1.4

D18-Listen

P1.5

D19-Go

Note      : Make SW32 to “Traffic” label marking position


 

 
Circuit Diagram to Interface Traffic Light with 8051



circuit-diagram-to-interface-traffic-light-with-8051



Source Code

The Interfacing Traffic Light Control with 8051 program is very simple and straight forward, which controls Traffic Light in certain time period. The C program is written in Keil software.


C Program to Traffic Light using 8051

***************************************************************************************


Title : Program to read traffic light controller


***************************************************************************************

 


 

 

#include <reg51.h>

sbit RA =    P1^0;

sbit YA  =   P1^1;

sbit GA  =   P1^2;

sbit RB  =   P3^2;

sbit YB  =   P3^3;

sbit GB  =   P3^4;

sbit RC  =   P3^5;

sbit YC  =   P3^6;

sbit GC  =   P3^7;

sbit rD  =   P1^3;

sbit YD  =   P1^4;

sbit GD  =   P1^5;

void Delay (void)

{

    unsigned int i,j;

    for (i=0;i<200;i++)

         for (j=0;j<500;j++);

}

void SuperDelay ()

{

    unsigned int i;

    for (i=0;i<25;i++)

         Delay();

}

void main ()

{

    P3  =   0;

    while (1)

    {

         RA  =   0; GA  =   1;  YA  =   0;

         RB  =   1;  GB  =   0;  YB  =   0;

         RC  =   1;  GC  =   0;  YC  =   0;

         rD  =   1;  GD  =   0;  YD  =   0;

 

         SuperDelay();

 

         GA  =   0;  YA  =   1;

         Delay();

         RA  =   1; GA  =   0;  YA  =   0;

         RB  =   0;  GB  =   1;  YB  =   0;

         RC  =   1;  GC  =   0;  YC  =   0;

         rD  =   1;  GD  =   0;  YD  =   0;

        SuperDelay ();

         GB  =   0;  YB  =   1;

         Delay ();

         RA  =   1; GA  =   0;  YA  =   0;

         RB  =   1;  GB  =   0;  YB  =   0;

         RC  =   0;  GC  =   1;  YC  =   0;

         rD  =   1;  GD  =   0;  YD  =   0;

SuperDelay ();

         GC  =   0;  YC  =   1;

         Delay();

         RA  =   1; GA  =   0;  YA  =   0;

         RB  =   1;  GB  =   0;  YB  =   0;

         RC  =   1;  GC  =   0;  YC  =   0;

         rD  =   0;  GD  =   1;  YD  =   0;      

SuperDelay ();

         GD  =   0;  YD  =   1;

         Delay();     

            

    }

}

 

 

Join the World's Largest Technical Community

we respect your privacy.