#include
unsigned char ledtab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}
void delay(unsigned char a)
{
unsigned char i,j;
for(i=0;ifor(j=0;j<120;j++);
}
main()
{
unsigned char i;
while(1)
{
for(i=0;i<8;i++){P0=ledtab[i];delay(100);}
for(i=0;i<8;i++){P0=ledtab[7-i];delay(100);}
}
}
#include
#include
void delay(int x)
{
int a,b;
for(a=0;a
for(b=0;b<120;b++)
; }
}
void main()
{
while(1)
{
unsigned char i;
for(i=0;i<8;i++)
{
P2=_crol_(0x01,i);
delay(150); }
}
}
}
参考:
http://hi.baidu.com/do_sermon/item/e69c66d832d426e3795daa82