#include"AT89x52.h"
#include"intrins.h"
#define uint unsigned int
#define uchar unsigned char
void DelayMS(uint z)
{
uint i=0;
for(;z>0;z--)
{
for(;i<20;i++);
}
}
sbit WEI=P2^1;
sbit SJ=P1^4;
uchar k,j;
void main(void)
{
uchar LED=0xfe;
SJ=0;
WEI=1;
P0=0xff;
WEI=0;
while(1)
{
j=_crol_(LED,1);
LED=j;
P0=LED;
DelayMS(20);
}
}
这是我写的流水灯程序,为什么结果是全部都亮呢。请指点 |