Program for Traffic Signal.
Program of Traffic Signal by using the C programing of micro controler.#include <reg51.h>
void MSDelay(unsigned int);
void main(void)
{
P1=0x00;
P3=0x00;
P2=0x00;
for (;;)
{
P1=0x24;
P3=0x03;
MSDelay(400);
P1=0x22;
P3=0x03;
MSDelay(400);
P1=0x21;
P3=0x09;
MSDelay(400);
P1=0x11;
P3=0x09;
MSDelay(400);
P1=0x0C;
P3=0x09;
MSDelay(400);
P1=0x8C;
P3=0x08;
MSDelay(400);
P1=0x64;
P3=0x08;
MSDelay(400);
P1=0x64;
P3=0x04;
MSDelay(400);
}
}
void MSDelay(unsigned int itime)
{
unsigned int i,j;
for (i=0;i<itime;i++)
{
for (j=0;j<1275;j++);
}
}