#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit P32=P3^3;
uchar i,j,time1,time2;
uint code array1[]={
400,400,650,650,650,1200,
400,400,650,650,650,1200,
400,400,650,650,650,650,1200,
400,400,650,650,650,1200
};
uchar code array[]={
0xfd,0x79,0xfd,0x79,0xfd,0xc7,0xfd,0x79,0xfe,0x21,0xfe,0x05,
0xfd,0x79,0xfd,0x79,0xfd,0xc7,0xfd,0x79,0xfe,0x51,0xfe,0x21,
0xfd,0x79,0xfd,0x79,0xfe,0xc0,0xfe,0x84,0xfe,0x21,0xfe,0x05,0xfd,0xc7,
0xfe,0x99,0xfe,0x99,0xfe,0x90,0xfe,0x21,0xfe,0x51,0xfe,0x21
};
uchar code LED[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
void delay(uint m)
{
uint n;
for(;m>0;m--)
for(n=80;n>0;n--);
}
void main()
{ uint a=0;
TMOD=0x01;
TH0=0;
TL0=0;
EA=1;
ET0=1;
TR0=1;
while(1)
{ if(a==8)
{a=0;}
time1=array[i++];
time2=array[i++];
if(i==50)
i=0;
P1=LED[a];
a++;
delay(array1[j++]);
P0=1;
if(j==25)
{ j=0;}
}
}
void init() interrupt 1
{
TR0=0;
P32=~P32;
TH0=time1;
TL0=time2;
TR0=1;
}