1、sbit P1_7=P17;uchar code table=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71; uchar temp,key,i,j,STH0,STL0;uint code tab=64260,64400,64463,64580,64684,64777,64820,64898,64968,64994,65058,65110,65157,65178,65217,65252;uint code tabb=64463,64524,64633,64732,64777,6486
2、0,64934,64994,65030,65085,65134,65157,65198,65235,65268,65283;/void display( uchar key);void delay(uint z);void music(); void main(void) TMOD=0x01; ET0=1; EA=1; while(1) if(P1_7=0) b+; if(b=2) b=0; if(b=0) P3=0xff; P3_4=0; temp=P3; temp=temp & 0x0f; if (temp!=0x0f) delay(5); switch(temp) case 0x0e:
3、key=0; break; case 0x0d: key=1; case 0x0b: key=2; case 0x07: key=3; /display(key); P2_3=P23; P2_4=P2_4; STH0=tabkey/256; STL0=tabkey%256; TR0=1; while(temp!=0x0f) temp=P3; temp=temp&0x0f; TR0=0; P2_3=1; P2_4=1; P3_5=0; for(i=50;i0;i-) for(j=200;jj-); key=4; key=5; key=6; key=7; P3_6=0; key=8; key=9;
4、 key=10; key=11; / display(key); while(temp! temp=P3; temp=temp& P2_3=1; P2_4=1; P3_7=0; key=12; key=13; key=14; key=15; P2_3=P23; P2_4=P2_4; /display(key); if(b=1) music();void music()STH0=tabb12/256;STL0=tabb12%256;TR0=1;delay(500) ;TR0=0;STH0=tabb13/256;STL0=tabb13%256;/;STH0=tabb10/256;STL0=tabb
5、10%256;delay(2000) ;delay(500);STH0=tabb9/256;STL0=tabb9%256; delay(500) ;delay(750) ;delay(250) ;delay(1000) ;STH0=tabb6/256;STL0=tabb6%256;STH0=tabb5/256;STL0=tabb5%256;delay(4000) ;/|; delay(250) ; delay(4000) ;STH0=tabb7/256;STL0=tabb7%256;STH0=tabb8/256;STL0=tabb8%256; delay(500);STH0=tabb3/256;STL0=tabb3%256;for(a=0;a2;+a) delay(1500) ; delay(750) ; delay(2000) ;STL0=tabb12%25
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1