ATM机输入为65535时为p灯亮

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

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];}}}}

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功