资源描述:
《单片机矩阵键盘汇编语言程序.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、51单片机4*4矩阵键盘汇编语言程序示例(原创)QQ:342250023,欢迎咨询线反转法ORG00HLJMPMAINMAIN:MOVR0,#00HMOVR1,#00HMOVR2,#00HMOVR3,#00HMOVA,#00HAJMPKEYSCANKEYSCAN:MOVP3,#0F0HMOVA,P3ANLA,#0F0HXRLA,#0F0HJNZDELAYDELAY:MOVR2,#05HLOOP1:MOVR3,#0FAHLOOP2:DJNZR3,LOOP2DJNZR2,LOOP1MOVA,P3ANLA,#0F0HMOVR0,AXRLA,#0F0HJNZKEY
2、SCAN1LJMPKEYSCANKEYSCAN1:MOVA,#00HMOVP3,#0FHMOVA,P3ANLA,#0FHMOVR1,AXRLA,#0FHJNZNUMLJMPKEYSCANNUM:MOVA,R0MOVB,R1ORLA,BMOVDPTR,#TABSJMPDISP0DISP0:CJNEA,#0EEH,DISP1MOVA,#00HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKEYSCANDISP1:CJNEA,#0EDH,DISP2MOVA,#01HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKE
3、YSCANDISP2:CJNEA,#0EBH,DISP3MOVA,#02HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKEYSCANDISP3:CJNEA,#0E7H,DISP4MOVA,#03HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKEYSCANDISP4:CJNEA,#0DEH,DISP5MOVA,#04HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKEYSCANDISP5:CJNEA,#0DDH,DISP6MOVA,#05HMOVCA,@A+DPTRMOVP0,ALC
4、ALLDELAY1LJMPKEYSCANDISP6:CJNEA,#0DBH,DISP7MOVA,#06HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKEYSCANDISP7:CJNEA,#0D7H,DISP8MOVA,#07HMOVCA,@A+DPTRMOVP0,ALCALLDELAY1LJMPKEYSCANDIS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