#include
unsigned char ledxs[]={0x00,0x10,0x80,0x90,0x40,0x50,0xC0,0xD0,0x20,0x30};
unsigned char ledd[4][25]={{0xfe,0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0x7f,0xff,0x7f,0x3f,0x9f,0xcf,0xe7,0xf3,0xf9,0xfc,0xfe,0xff},
{0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,0xe7,0xc3,0x81,0x00,0x81,0xc3,0xe7,0xff},
{0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xaa,0x55,0xaa,0x55},
{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff,0x00,0xff,0x00}};
int i=0,j=0,k=0,jscs=0;
void ys(unsigned int time){
unsigned int m=0;
for(;time>0;time--)
for(m=0;m<125;m++);
}
timer1() interrupt 3{
jscs++;
if(jscs==20)
{ jscs=0;
i++;
if(i==10){
i=0;
j++;
k=0;
if(j==4) j=0;
}
P2=ledxs[i];}
TH1=0x3c;
TL1=0xb0;
}
void main(){
TR1=1;
EA=1;
TMOD=0x10;
TH1=0x3c;
TL1=0xb0;
ET1=1;
while(1)
{
switch(j)
{
case 0: P1=ledd[0][k];
ys(200);
k++;
if(k==20) k=0;
break;
case 1: P1=ledd[1][k];
ys(250);
k++;
if(k==16) k=0;
break;
case 2: P1=ledd[2][k];
ys(300);
k++;
if(k==21) k=0;
break;
case 3: P1=ledd[3][k];
ys(350);
k++;
if(k==22) k=0;
break;
}
}
}
|