//滚动显示68639665数字
//Create Time :2008-08-25
#include #include #define uchar unsigned char
#define uint unsigned int
uchar code table[96]={ 0x82,0x80,0x82,0xb0,0x90,0x82,0x82,0x92,
0x80,0x82,0xb0,0x90,0x82,0x82,0x92,0xff,
0x82,0xb0,0x90,0x82,0x82,0x92,0xff,0xff,
0xb0,0x90,0x82,0x82,0x92,0xff,0xff,0xff,
0x90,0x82,0x82,0x92,0xff,0xff,0xff,0xff,
0x82,0x82,0x92,0xff,0xff,0xff,0xff,0x82,
0x82,0x92,0xff,0xff,0xff,0xff,0x82,0x80,
0x92,0xff,0xff,0xff,0xff,0x82,0x80,0x82,
0xff,0xff,0xff,0xff,0x82,0x80,0x82,0xb0,
0xff,0xff,0xff,0x82,0x80,0x82,0xb0,0x90,
0xff,0xff,0x82,0x80,0x82,0xb0,0x90,0x82,
0xff,0x82,0x80,0x82,0xb0,0x90,0x82,0x82}; //滚动显示数据
uchar data temp[8]; //建立显示缓冲区
void delay (void);
main ()
{
uchar n,m;
TMOD=0X01;
ET0=1;
EA=1;
TH0=0XFC;
TL0=0X18;
TR0=1;
//****************每隔一段时间更新一次显示缓冲区的数据*******//
while (1)
{
for (n=0;n<=7;n++)
{
temp[n]=table[m];
m++;
if (m>95) m=0;
}
delay ();
}
}
//***************动态扫描程序******************
void dis_show (void) interrupt 1
{
static uchar i=0,digit=0xfe;
TH0=0XFC;
TL0=0X18;
P0=temp[i];
P3=digit;
i++;
if (i>7) i=0;
if (digit<0x7f) digit=0xfe; //扫完一圈后,从头再扫描
digit=_crol_(digit,1); //向左移动一位
}
//**************延时**********
void delay (void)
{
uint x,y;
for (x=0;x<=350;x++)
{
for (y=0;y<=100;y++);
}
}