初步程序:#include#define uchar unsigned charsbit P3_4=P3^4;//code uchar tab[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,};//code uchar tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};code uchar tab[10]={0xbf,0x86,0xdb,0xcf,0x66,0xed,0xfd,0x87,0xff,0xef,};uchar sz[4];int qw,bw,sw,gw,a,b,c;void disp(void){for(c=3;c>=0;c--){SBUF=tab[sz[c]];while(!TI);TI=0;}}void scjs(void)interrupt 3{TH1=0X3C;TL1=0xB0;a=a+1;if(a==2){a=0;P3_4=!P3_4;if(P3_4==0){b=TH0*256+TL0;///yw=sz[0]=b/100000;//ww=sz[0]=b/10000%10;qw=sz[0]=b/1000%10;bw=sz[1]=b/100%10;sw=sz[2]=b/10%10;gw=sz[3]=b%10;disp();}}}main(){TMOD=0x15;IE=0X88;TH1=0X3C;TL1=0XB0;TR0=1;TR1=1;a=0;while(1);}2#include#define uchar unsigned charsbit P3_4=P3^4;//code uchar tab[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,};//code uchar tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};code uchar tab[10]={0xbf,0x06,0xdb,0xcf,0x66,0xed,0xfd,0x87,0xff,0xef,};uchar sz[6];int yw,ww,qw,bw,sw,gw,a,b,c,d,e,f;void disp(void){for(c=5;c>=0;c--){SBUF=tab[sz[c]];while(!TI);TI=0;}}void scjs(void)interrupt 3{TH1=0X3C;TL1=0xB0;a=a+1;if(a==2){a=0;P3_4=!P3_4;if(P3_4==0){b=TH0*256+TL0;d=34;e=6;f=7;qw=sz[0]=b/100000;bw=sz[1]=b/10000%10;sw=sz[2]=b/1000%10;gw=sz[3]=b/100%10;yw=sz[4]=b/10%10;ww=sz[5]=b%10;disp();}}}main(){TMOD=0x15;IE=0X88;TH1=0X3C;TL1=0XB0;TR0=1;TR1=1;a=0;while(1);}3#include#define uchar unsigned charsbit P3_4=P3^4;sbit jia=P2^0;sbit jian=P2^1;sbit gl=P2^2;sbit hp=P2^3;unsigned char keycnt=0;//code uchar tab[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,};//code uchar tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};code uchar tab[10]={0xbf,0x06,0xdb,0xcf,0x66,0xed,0xfd,0x87,0xff,0xef,};uchar sz[6];int yw,ww,qw,bw,sw,gw,a,b,c,d,e,f;d=46; //单价e=00; //公里数f=00;//jiage=d*e; //金额void disp(void){for(c=5;c>=0;c--){SBUF=tab[sz[c]];while(!TI);TI=0;}}void KEY() //按键扫描程序{unsigned char i,j;if(hp==0){for(i=20;i>0;i--) //延时去干扰for(j=248;j>0;j--);if(hp==0){keycnt++;switch(keycnt) //按下次数判断{case 1: //第一次按下d=40;break;case 2: //第二次按下d=50;break;case 3: //第三次按下d=60;keycnt=0; //重新开始判断键值break;}while(hp==0);} }} void scjs(void)interrupt 3{TH1=0X3C;TL1=0xB0;a=a+1;if(a==2){a=0;P3_4=!P3_4;if(P3_4==0){//b=TH0*256+TL0;f=e*d/10;qw=sz[0]=d/10%10;bw=sz[1]=d%10;sw=sz[2]=e/10%10;gw=sz[3]=e%10;yw=sz[4]=f/10%10;ww=sz[5]=f%10;if(jia==0){d++;}if(jian==0){d--;}if(gl==0){e=5;}disp();KEY(); }}}main(){void KEY();TMOD=0x15;IE=0X88;TH1=0X3C;TL1=0XB0;TR0=1;TR1=1;a=0;while(1);}4#include#define uchar unsigned charsbit P3_4=P3^4;sbit jia=P2^0;sbit jian=P2^1;sbit gl=P2^2;sbit hp=P2^3;sbit j=P2^4;unsigned char keycnt=0;unsigned char cnt=0;//code uchar tab[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,};//code uchar tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};code uchar tab[10]={0xbf,0x06,0xdb,0xcf,0x66,0xed,0xfd,0x87,0xff,0xef,};uchar sz[6];int yw,ww,qw,bw,sw,gw,a,b,c,d,e,f,g;d=46; //单价e=00; //公里数f=00;//jiage=d*e; //金额void jishuqi(){if(j==0)cnt++;if(cnt=100)e++;cnt=0;}void disp(void){for(c=5;c>=0;c--){SBUF=tab[sz[c]];while(!TI);TI=0;}}void KEY() //按键扫描程序{unsigned char i,j;if(hp==0){for(i=20;i>0;i--) //延时去干扰for(j=248;j>0;j--);if(hp==0){keycnt++;switch(keycnt) //按下次数判断{case 1: //第一次按下d=46;break;case 2: //第二次按下d=12;break;case 3: //第三次按下d=78;keycnt=0; //重新开始判断键值break;}while(hp==0);} }} void scjs(void)interrupt 3{TH1=0X3C;TL1=0xB0;a=a+1;if(a==2){a=0;P3_4=!P3_4;if(P3_4==0){//b=TH0*256+TL0;if(e>3)f=g;else f=5;//g=e*d/10;//f=e*d/10+5;qw=sz[0]=d/10%10;bw=sz[1]=d%10;sw=sz[2]=e/10%10;gw=sz[3]=e%10;yw=sz[4]=f/10%10;ww=sz[5]=f%10;if(jia==0){d++;}if(jian==0){d--;}if(gl==0){e=5;}disp();KEY();jishuqi(); }}}main(){void KEY();TMOD=0x15;IE=0X88;TH1=0X3C;TL1=0XB0;TR0=1;TR1=1;a=0;while(1);}5#include#define uchar unsigned charsbit P3_4=P3^4;sbit jia=P2^0;//价格加sbit jian=P2^1;//价格减sbit gl=P2^2; //公里sbit hp=P2^3; //换屏sbit j=P2^4;//记数unsigned char keycnt=0;unsigned char cnt=0;//code uchar tab[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,};//code uchar tab[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,};code uchar tab[10]={0xbf,0x06,0xdb,0xcf,0x66,0xed,0xfd,0x87,0xff,0xef,};uchar sz[6];int yw,ww,qw,bw,sw,gw,a,b,c,d,e,f,g;d=46; //单价e=03。