keil uVision4界面:
#include<reg52.h>
sbit K1=P2^0;
sbit K2=P2^1;
sbit K3=P2^2;
sbit K4=P2^3;
sbit D1=P3^0;
sbit D2=P3^6;
sbit D3=P3^7;
unsigned char tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
unsigned char sec,t=0,key;
void delay(int z)
{
int x,y;
for(x=100;x>0;x--)
for(y=z;y>0;y--);
}
void main()
{
TMOD=0X01;
EA=1;
ET0=1;
P2=0xff;
sec=90;
P0=0xff;//P0=tab[sec/10];
P1=