Program for LED Blinking in Fashion

#include<8051.h>
#include<stdio.h>
void delay (int time)
{
unsigned int i,j;
for (i=0;i<=time*10;i++)
{
for (j=0;j<=time*10;j++)
{
}}}
void main()
{
P1=0xff;
while(1)
{
P1=0x00;
delay(10);
P1_0=1;
delay(10);
P1_1=1;
delay(10);
P1_2=1;
delay(10);
P1_3=1;
delay(10);
P1_4=1;
delay(10);
P1_5=1;
delay(10);
P1_6=1;
delay(10);
P1_7=1;
delay(10);



P1=0x00;
delay(10);
P1_7=1;
delay(10);
P1_6=1;
delay(10);
P1_5=1;
delay(10);
P1_4=1;
delay(10);
P1_3=1;
delay(10);
P1_2=1;
delay(10);
P1_1=1;
delay(10);
P1_0=1;
delay(10);



P1=0x00;
delay(10);
P1=0x81;
delay(10);
P1=0xc3;
delay(10);
P1=0xe7;
delay(10);
P1=0xff;
delay(10);



P1=0x00;
delay(10);
P1=0x18;
delay(10);
P1=0x3c;
delay(10);
P1=0x7e;
delay(10);
P1=0xff;
delay(10);


P1=0x00;
delay(15);
P1_0=1;
delay(15);
P1_1=1;
delay(15);
P1_2=1;
delay(15);
P1_3=1;
delay(15);
P1_4=1;
delay(15);
P1_5=1;
delay(15);
P1_6=1;
delay(15);
P1_7=1;
delay(15);



P1=0x00;
delay(15);
P1_7=1;
delay(15);
P1_6=1;
delay(15);
P1_5=1;
delay(15);
P1_4=1;
delay(15);
P1_3=1;
delay(15);
P1_2=1;
delay(15);
P1_1=1;
delay(15);
P1_0=1;
delay(15);



P1=0x00;
delay(15);
P1=0x81;
delay(15);
P1=0xc3;
delay(15);
P1=0xe7;
delay(15);
P1=0xff;
delay(15);



P1=0x00;
delay(15);
P1=0x18;
delay(15);
P1=0x3c;
delay(15);
P1=0x7e;
delay(15);
P1=0xff;
delay(15);


P1=0x00;
delay(15);
P1=0x80;
delay(15);
P1=0x40;
delay(15);
P1=0x20;
delay(15);
P1=0x10;
delay(15);
P1=0x08;
delay(15);
P1=0x04;
delay(15);
P1=0x02;
delay(15);
P1=0x01;
delay(15);


P1=0x00;
delay(15);
P1=0x01;
delay(15);
P1=0x02;
delay(15);
P1=0x04;
delay(15);
P1=0x08;
delay(15);
p1=0x10;
delay(15);
P1=0x20;
delay(15);
P1=0x40;
delay(15);
P1=0x80;
delay(15);


P1=0x00;
delay(15);
P1=0x81;
delay(15);
P1=0x42;
delay(15);
P1=0x24;
delay(15);
P1=0x18;
delay(15);


P1=0x00;
delay(15);
P1=0x18;
delay(15);
P1=0x24;
delay(15);
P1=0x42;
delay(15);
P1=0x81;
delay(15);
}
}

0 comments:

Post a Comment

 
Copyright Electronics Projects And Details All Rights Reserved
ProSense theme created by Dosh Dosh and The Wrong Advices.
Blogerized by Alat Recording Studio Rekaman.