#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar table1[]=
{0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,
0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,
0x08,0x20,0xF8,0x3F,0x88,0x20,0xC0,0x01,
0x28,0x26,0x18,0x38,0x08,0x20,0x00,0x00};
uchar table[]=
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x08,0x20,0x08,0x20,0xF8,0x3F,
0x08,0x20,0x08,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uchar table2[]=
{ 0x00,0x40,0x40,0x20,0xB2,0xA0,0x96,0x90,
0x9A,0x4C,0x92,0x47,0xF6,0x2A,0x9A,0x2A,
0x93,0x12,0x91,0x1A,0x99,0x26,0x97,0x22,
0x91,0x40,0x90,0xC0,0x30,0x40,0x00,0x00,
0x00,0x40,0x40,0x20,0xB2,0xA0,0x96,0x90,
0x9A,0x4C,0x92,0x47,0xF6,0x2A,0x9A,0x2A,
0x93,0x12,0x91,0x1A,0x99,0x26,0x97,0x22,
0x91,0x40,0x90,0xC0,0x30,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uchar v,flag,temp;
uchar i,j,k,shuz,shub,temp1;
uchar a,b,c,d,e,f,numa,numb;
uchar ii,jj,kk;
uchar iii,jjj,kkk;
uchar a3,b3;
uchar num3,temp3;
uchar temp2;
void init();
void init1();
void init2();
void init3();
void disp1();
void disp2();
void disp3();
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
{
for(y=110;y>0;y--);
}
}
void main()
{
init();
while(1)
{
if(flag%3==0)
{
init1();
while(flag%3==0)
{
for(i=0;i<=a;i++)
for(j=0;j<=v;j++)
for(k=i*2;k<(i*2+32);)
if(flag%3==0)
disp1();
else
{
i=a;j=v;k=(i*2+32);
}
}
}
if(flag%3==1)
{
init2();
while(flag%3==1)
{
for(ii=0;ii<=15;ii++)
for(jj=0;jj<=v;jj++)
for(kk=0;kk<=15;kk++)
if(flag%3==1)
disp2();
else
{
ii=15;jj=v;kk=15;
}
delay(1);
}
}
}
}
//if(flag%3==2)
//{
// init3();
//// while(flag%3==2)
// {
// for(iii=0;iii<=6*32;iii=iii+32)
// for(jjj=0;jjj<=v*10;jjj++)
// { for(kkk=0;kkk<=15;kkk++)
// if(flag%3==2)
// disp3();
// num3=0;
// temp3=0;
// }
// }
// }
// }
//}
void init()
{EA=1;
EX0=1;
EX1=1;
IT0=1;
IT1=1;
v=15;
}
void init1()
{
shuz=5;
shub=1;
a=shuz*16+shub*8+14;
P0=0xff;
P2=0xff;
temp1=0;
}
void disp1()
{
P0=table[k];
k++;
P2=table[k];
k++;
P1=temp1;
delay(1);
temp1++;
if(temp1==0x10)
temp1=0x00;
}
void init2()
{
P0=0xff;
P2=0xff;
temp2=0;
}
void disp2()
{
numa=kk*2;
numb=kk*2+1;
a=table1[numa];
b=table1[numb];
if(jj==v)
{ c=a>>1;
d=b<<(8-1);
e=b>>1;
f=a<<(8-1);
c=c|d;
table1[numa]=c;
e=e|f;
table1[numb]=e;
}
P0=a;
P2=b;
P1=temp2;
temp2++;
if(temp2==0x10)
temp2=0x00;
delay(1);
}
void init3()
{
P0=0xff;
P2=0xff;
num3=0;
temp3=0;
}
void disp3()
{
a3=table2[iii+(num3++)];
b3=table2[iii+(num3++)];
P0=a3;
P2=b3;
P1=temp3++;
delay(1);
}
void timerr1() interrupt 1
{
v=15;
flag++;
temp1=0x00;
temp2=0x00;
temp3=0x00;
}
void timerr0() interrupt 3
{
v=v/3;
if(v==0)
v=150;
}
|