#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code f[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
sbit wela=P1^1;
sbit dula=P1^0;
sbit jian=P2^4;
sbit jian2=P2^5;
uchar a=0,b=0,c;
uchar key_1(void);
uchar key_2(void);
void delay(uint z)
{
 uint x,y;
 for(x=z;x>0;x--)
  for(y=150;y>0;y--);

void main()
{
 uchar a=0,b=0,i,dis_a,dis_b;
 while(1)
 {
   dis_a=f[a++];
   dis_b=f[++b];
   for(i=0;i<250;i++)
   {
      dula=1;
   P0=dis_a;
   dula=0;
   P0=0xff;
   wela=1;
   P0=0xfe;
   wela=0;
   delay(5);

dula=1;
   P0=dis_b;
   dula=0;
   P0=0xff;
   wela=1;
   P0=0xfd;
   wela=0;
   delay(5);
            }
if((a==9)||b==9) while(1);
     }
}

05-11 17:53