我敲了个流水灯的代码但是始终只亮一个灯,看了好几天了找不出来,
#include <STC15F2K60S2.H>
void Delay1ms(unsigned char n) //@11.0592MHz
{
unsigned char i, j;
while(n--)
{
i = 11;
j = 190;
do
{
while (--j);
} while (--i);
}
}
void main()
{
while(1)
unsigned char num;
unsigned int i;
P0=0xFF;
while(1)
{
for(i=0;i<=7;i++)
{
Delay1ms(100);
num=0x01;
P0=~num;
num=num<<1;
if(num==0x00)
{
num=0x01;
}
}
}
}
}