#include<reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
void delay(uint);
uchar temp;
void main()
{
temp=0xfe;
while (P1!=0x7f)
{
P0=temp;
delay(100);
temp=_crol_(temp,1);
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=500;y>0;y--);
}
先让灯亮一会再作移位 |