#include
#define uchar unsigned char
#define uint unsigned int
uint num=0,i=0;
uchar code LED[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void main()
{
EA=1;
ET0=1;
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TR0=1;
P1=0;
while(1)
{
if(num==2)
{
num=0;
P1=LED[i];
i++;
if(i>7) i=0;
}
}
}
void time0() interrupt 1
{
num++;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
}
#include
#include
void delay(int a)
{
while(a--);
}
main()
{
P2=0xfe;
while(1)
{
P2=_crol_(P2,1);
delay(30000);
}
}