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,a;
while(1)
{
a=0xff;
for(i=0;i<8;i++)
{
a=a>>1; // right shift operator
P1=a;
ms_delay(500);
}
}
}
0 comments:
Post a Comment