Question

#Welcome #assembly #proteus Automatic Traffic Light controller using 8051 microcontroller | Full [Code+circuit] traffic light

please write a program in assembly language and in C language to run under Microcontroller 8051.Indicate comments. Thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Automatic Traffic light controller In 8051 C Programming-

#include<stdio.h>

#include<reg51.h>

sbit RA = P1^0;sbit YA = P1^1;sbit GA = P1^2;
sbit rD = P1^3;sbit YD = P1^4;sbit GD = P1^5;
sbit RB = P3^2;sbit YB = P3^3;sbit GB = P3^4;
sbit RC = P3^5;sbit YC = P3^6;sbit GC = P3^7;


void Delay (void)
{
unsigned int a,b;

for (a=0;a<200;a++)
for (b=0;b<500;b++);
}

void SuperDelay()
{
unsigned int a;
for (a=0;a<25;a++)
Delay();
}
void main ()
{
P3 = 0;while (1)
{
RA = 0;GA = 1;YA = 0;RB = 1;
YC = 0;rD = 1;GD = 0;YD = 0;
GB = 0;YB = 0;RC = 1;GC = 0;

SuperDelay();
GA = 0;
YA = 1;
Delay();
RC = 1;GC = 0;YC= 0;
rD = 1;GD = 0;YD = 0;
RA = 1;GA = 0;YA = 0;
RB = 0;GB = 1;YB = 0;

SuperDelay ();

GB = 0;YB = 1;
Delay ();
RA = 1;GA = 0;YA = 0;
RC = 0;GC = 1;YC = 0;
rD = 1;GD = 0;YD = 0;
RB = 1;GB = 0;YB = 0;

SuperDelay ();

GD = 1;YD = 0;
GC = 0;YC = 0;rD = 0;

SuperDelay ();

GD = 0;YD = 1;

Delay();
}
}

Add a comment
Know the answer?
Add Answer to:
please write a program in assembly language and in C language to run under Microcontroller 8051.Indicate comments. T...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT