ATM机输入为65535时为p灯亮,否则为e,可撤销和清零#includereg51.h#includeintrins.h#includeabsacc.h#defineucharunsignedchar#defineuintunsignedintuintH[16]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf,0xff,0xff,0xbf};voiddelay(uinti){uintj;for(j=0;ji;j++);}ucharcheckkey(){uinti,j;j=0x0f;P3=j;i=P3;i=i&0x0f;if(i==0x0f)return(0);elsereturn(0xff);}ucharkeyscan(){ucharscancode;ucharcodeaddr;uchara;ucharm=0;uchark;uchari,j;if(checkkey()==0)return(0xff);else{delay(100);if(checkkey()==0)return(0xff);else{scancode=0xf7;m=0x00;for(i=1;i=4;i++){k=0x10;P3=scancode;a=P3;for(j=0;j4;j++){if((a&k)==0){codeaddr=m+j;while(checkkey()!=0);return(codeaddr);}k=k1;}m=m+4;scancode=~scancode;scancode=scancode1;scancode=~scancode;}}}}voidmain(){uintq,w,e,r,t,m,key;uintn;P2=0Xbf;while(1){if(checkkey()==0)continue;else{n=keyscan();if(n=0&&n=9){key++;P2=H[n];if(key==1)q=n;if(key==2)w=n;if(key==3)e=n;if(key==4)r=n;if(key==5)t=n;}delay(100);if(n==10){key=0;q=0;w=0;e=0;r=0;t=0;P2=0XBF;P1=0X01;}if(n==11){if((q*10000+w*1000+e*100+r*10+t)==65535){P1=0X00;P2=0X0C;}else{P2=0X06;}}if(n==12){key--;if(key==-1)key=0;if(key==0)n=13;if(key==1)n=q;if(key==2)n=w;if(key==3)n=e;if(key==4)n=r;P2=H[n];}}}}