#include<reg51.h>
sbit key1=P3^2; //
sbit key2=P3^3; //
#define dx P0 //
#define wx P2 //
unsigned char count=0;//
unsigned char code led_code[20]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xd8,0x80,0x90};//
void OUT_INT0() interrupt 0
{if(key1==0)
{
while(key1==0);//
count++;
if(count==10) count=0;//
}
}
void OUT_INT1() interrupt 2
{
if(key2==0)//
{
while(key2==0);//
count--;
if(count==0) count=10;//
}
}
void disp()
{
wx=0xfe;//
dx=led_code[count];//
}
void main()
{
P3=0xff;//
EA=1;EX0=1;PX0=1;
TCON=0X01;//
P3=0xff;//
EA=1;EX1=1;PX1=1;
TCON=0X02;
while(1)
{
disp();
}
}