Ad Code

Traffic signal timer simulation

 Traffic signal timer simulation using proteus

traffic signal timer banner

In our day to day life, we always get a traffic signal on our way, where you need to wait for a particular time for the signal to get green. Hence in today's article, we will talk about the simulation of the traffic signal timer.

The simulation software I am using is proteus 8 professional and for writing the code I am using Keil MicroVision 5.

The microcontroller we will be working on is AT89C51 microcontroller.

We will cover the article on the following topics:
  • Hardware components for simulation.
  • Making the hardware connection for simulation.
  • Writing the program for the microcontroller
  • Uploading the program on the microcontroller.
  • Simulate the project.

Hardware component for simulation

The hardware components we are using for simulation are:
  • AT89C51 microcontroller
  • Animated traffic light module
  • 7-segment BCD display
  • 8-way resistor pack with common

Making the hardware connection for simulation

In this section, we will connect all our hardware components in our simulation 

The picture for the hardware connection is given below.

proteus simulation circuit

While making connections make sure the correct pin of the microcontroller is connected to the correct devices.

Writing the program for the microcontroller

In this section, we will write our program on Keil Microvision 5 software and generate the hex file, so it can be upload to our proteus simulation.

If you don't know how to generate a hex file you can click here.

code

#include <reg51.h>

int i,j;

void delay()
{
  for(i=0;i<14;i++)
{
TMOD=0x01;
  TH0=0;
TL0=0;
TR0=1;
while(TF0==0);
TF0=0;
TR0=0;
}
}

void count()
{
  for(j=5;j>=0;j--)
{
  P3=j;
delay();
}
}

void main()
{
P0=0x54;
P2=0x02;
count();
P0=0xA1;
P2=0x02;
count();
P0=0x09;
P2=0x05;
count();
P0=0x4A;
P2=0x08;
count();

}

Uploading the program to the microcontroller

After completing the programming part you can upload the code to the microcontroller on proteus.

For that, you need to double click on the microcontroller and select your created hex file.

Note:- Don't forget to change the clock frequency of the microcontroller from 12MHz to 11.059MHz.

To simulate the project all you need is to click the play button at the bottom left corner of the simulator.

Or you can watch the video given below.

Video description