Refer 'LED Basic Circuit' in 'Embedded Systems Circuits' Label
#include<reg51.h>
#include<intrins.h>
void ms_delay(unsigned int a)
{
unsigned char b=255;
for(;a-->0;)
for(;b-->0;)
_nop_();
}
void main()
{
unsigned char i,s,a,b,j,c;
while(1)
{
a=0xff;
b=0;
for(i=0;i<8;i++)
{
c=0x01;
for(j=0;j<(8-b);j++)
{
s=c^(a>>b);
P1=~s;
c=c<<1;
ms_delay(500);
}
b++;
}
}
}
0 comments:
Post a Comment