#include<reg52.h>
#defineuchar unsigned char
#define uint unsigned int
uchar code table1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
sbit wela=P2^7;
sbit dula=P2^6;
void show(uchar j,uchar k)//显示第几个数码管所显示的数字
{
wela=1;
P0=table1[j];//显示第几个数码管
wela=0;
P0=0xff;
dula=1;
P0=table[k];//要显示的数字
dula=0;
P0=0xff;
}
void main()//主函数
{
uint i,j;
while(1)
{
for(i=0;i<6000;i++)
{
for(j=0;j<6;j++)
{
show((j+i/1000)%6,j+1);
}
}
}
}