用的是74LS154,埠地址是我隨便給了一個,正確的可以根據你的電路確定,是低電平有效,謬誤之處往多多見諒。include<at89x51.h>include<absacc.h>#define LS154 [0XC000]#define uchar unsigned charvoid delay(){unsigned m,n;unsigned templfor(m=2000,m>0,m--);for(n=500,n>0,n--);}void main(){temp=P1;swich(temp&P1_4=0){case 0xf0;P0=LS154|0x00FF;P2=LS154|0x0800;p1_5=1;delay();case oxf1;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf2;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf3;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf4;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf5;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf6;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf7;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf8;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf9;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfa;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfb;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfc;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfd;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfe;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxff;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();break;
用的是74LS154,埠地址是我隨便給了一個,正確的可以根據你的電路確定,是低電平有效,謬誤之處往多多見諒。include<at89x51.h>include<absacc.h>#define LS154 [0XC000]#define uchar unsigned charvoid delay(){unsigned m,n;unsigned templfor(m=2000,m>0,m--);for(n=500,n>0,n--);}void main(){temp=P1;swich(temp&P1_4=0){case 0xf0;P0=LS154|0x00FF;P2=LS154|0x0800;p1_5=1;delay();case oxf1;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf2;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf3;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf4;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf5;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf6;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf7;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf8;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxf9;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfa;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfb;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfc;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfd;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxfe;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();case oxff;P0=LS154|0xOOFF;P2=LS154|0x0800;p1_5=1;delay();break;