#include
#include
#define uchar unsingned char
#define uint unsigned int
uchar code Table_OF_Digits[]=
{
0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,//0
0x00,0x08,0x38,0x08,0x08,0x08,0x3E,0x00,//1
0x00,0x3C,0x04,0x04,0x3C,0x02,0x3C,0x00,//2
0x00,0x3C,0x04,0x3C,0x04,0x04,0x3C,0x00,//3
0x00,0x20,0x28,0x28,0x34,0x08,0x08,0x00,//4
0x00,0x3C,0x20,0x20,0x3C,0x04,0x3C,0x00,//5
0x00,0x20,0x20,0x20,0x3C,0x24,0x3C,0x00,//6
0x00,0x3C,0x04,0x04,0x04,0x04,0x04,0x00,//7
};
uint r=0;
char offset=0;
uchar Current_Level=1,Dest_Level=1,x=0,t=0;
void main()
{
p3 = 0x80;
Current_Level=1;
Dest_Level = 1;
TM0D = 0x01;
TH0 = -4000/256;
TL0 = 4000%256
TR0 = 1;
IE = 0x82;
whil(1);
}
void LED_Screen_Display() interrupt 1
{
uchar i ;
if(P1 !=0xFF && Current_Level==Dest_Leve1)
{
if(P1 == 0xFE) Dest_Level = 5;
if(P1 == 0xFD) Dest_Level = 4;
if(P1 == 0xFB) Dest_Level = 3;
if(P1 == 0xF7) Dest_Level = 2;
if(P1 == 0xEF) Dest_Level = 1;
}
TH0 = -4000/256;
TL0 = -4000%256;
P3 = _crol_(P3 , 1);
i = Current_Level * 8 + r + offset;
P0 = ~Table_0F_Digits[i];
if(Current_Level < Dest_Level)
{
if( ++r == 8)
{
r = 0;
if(++x == 4)
{
x = 0;
if(++offset == 8)
{
offset = 0;
Current_Level++;
}
}
}
}
else
if(Current_Level > Dest_Level)
{
if( ++r == 8)
{
r = 0;
if(++x == 4)
{
x = 0;
if(++x == 4)
{
x = 0;
if(--offset == -8)
{
offset = 0;
Current_Level--;
}
}
}
}
else
{
if( ++r == 8) r = 0;
}
}