LED Pattern Effect using 8051
Here are the 8 different types of codes made on LED controlled by 8-bit micro-controller. It is posted to enhance your programming skills on 8051 as basic skills are developed on LED interfacing with 8051 only.
Try to make your own programs and different method to develop new ways to solve the problems which will enhance your skills more.
Parts Used :
LED Bar Graph
Software Used:
Proteus ISI
1. Blink LED
#include <reg51.h>
void delay()
{
unsigned int i;
for(i=0;i<1000;i++)
{
}
}
void main()
{
while(1)
{
P1=0xff;
delay();
P1=0x00;
delay();
}
}
2. Alternative/ Dancing pattern:
#include <reg51.h>
void delay()
{
unsigned int i;
for(i=0;i<1000;i++)
{
}
}
void main()
{
while(1)
{
P1=0xAA;
delay();
P1=0x55;
delay();
}
}
3.Curtain effect:
#include <reg51.h>
void delay()
{
unsigned int i,j;
for(i=0;i<1000;i++)
{
for(j=0;j<20;j++)
{
}
}
}
void main()
{
while(1)
{
P1=0x81;
delay();
P1=0xC3;
delay();
P1=0xE7;
delay();
P1=0xFF;
delay();
P1=0xE7;
delay();
P1=0xC3;
delay();
P1=0x81;
delay();
P1=0x00;
delay();
}
}