预览加载中,请您耐心等待几秒...
1/5
2/5
3/5
4/5
5/5

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

方法一、ORG0000HLJMPMAINORG0100HMAIN:MOVP1,#0F0H//P1口设初值F0,矩阵按键高四位置1,低四位置0,JNBP1.4,Y0//用JNB检测按键端口,P1.4口低电平跳转Y0JNBP1.5,Y1JNBP1.6,Y2JNBP1.7,Y3SJMPMAINY0:MOV30H,#00HMOVP1,#0EFHJNBP1.4,X0MOVP1,#0DFHJNBP1.4,X1MOVP1,#0BFHJNBP1.4,X2MOVP1,#07FHJNBP1.4,X3Y1:MOV30H,#01HMOVP1,#0EFHJNBP1.0,X0MOVP1,#0DFHJNBP1.1,X1MOVP1,#0BFHJNBP1.2,X2MOVP1,#7FHJNBP1.3,X3Y2:MOV30H,#02HMOVP1,#0EFHJNBP1.0,X0MOVP1,#0DFHJNBP1.1,X1MOVP1,#0BFHJNBP1.2,X2MOVP1,#7FHJNBP1.3,X3Y3:MOV30H,#03HMOVP1,#0EFHJNBP1.0,X0MOVP1,#0DFHJNBP1.1,X1MOVP1,#0BFHJNBP1.2,X2MOVP1,#7FHJNBP1.3,X3X0:MOV31H,#00HACALLDELAYMOVP1,#0F0HLJMPJISUANX1:MOV31H,#01HACALLDELAYMOVP1,#0F0HLJMPJISUANX2:MOV31H,#02HACALLDELAYMOVP1,#0F0HLJMPJISUANX3:MOV31H,#03HACALLDELAYMOVP1,#0F0HLJMPJISUANJISUAN:MOVA,31HMOVB,#04HMULABADDA,30HMOVDPTR,#TABMOVCA,@A+DPTRMOVP0,ACC:MOVA,P1ANLA,#0F0HXRLA,#0F0HJNZCCLCALLMAINDELAY:MOVR4,#0C5HD1:MOVR5,#43HD0:MOVR6,#10HDJNZR6,$DJNZR5,D0DJNZR4,D1RETTAB:DB0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07DB0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71方法二、ORG0000HLJMPSTARTKEYSBUFEQU30HORG0100HSTART:MOVP1,#0F0HMOVA,P1ANLA,#0F0HXRLA,#0F0HJZSTARTLCALLDELAYMOVP1,#0F0HMOVA,P1ANLA,#0F0HXRLA,#0F0HJZSTARTMOVP1,#0FEH//第0行置0CLRP1.0MOVA,P1ANLA,#0F0H//与逻辑,高位保留CJNEA,#0E0H,K1//高四位为1110,数字0亮MOVKEYSBUF,#0LJMPDISPLAYK1:CJNEA,#0D0H,K2//高四位为1101,数字1亮MOVKEYSBUF,#1LJMPDISPLAYK2:CJNEA,#0B0H,K3//高四位为1011,数字2亮MOVKEYSBUF,#2LJMPDISPLAYK3:CJNEA,#070H,K4//高四位为0111,数字3亮MOVKEYSBUF,#3LJMPDISPLAYK4:MOVP1,#0FDH//第1行置0MOVA,P1ANLA,#0F0HCJNEA,#0E0H,K5//高四位为1110,数字4亮MOVKEYSBUF,#4LJMPDISPLAYK5:CJNEA,#0D0H,K6//高四位为1101,数字5亮MOVKEYSBUF,#5LJMPDISPLAYK6:CJNEA,#0B0H,K7//高四位为1011,数字6亮MOVKEYSBUF,#6LJMPDISPLAYK7:CJNEA,#070H,K8//高四位为0111,数字7亮MOVKEYSBUF,#7LJMPDISPLAYK8:MOVP1,#0FBH//第2行置0MOVA,P1ANLA,#0F0HCJNEA,#0E0H,K9//高四位为1110,数字8亮MOVKEYSBUF,#8LJMPDISPLAYK9:CJNEA,#0D0H,K10//高四位为1101,数字9亮MOVKEYSBUF,#9LJMPDISPLAYK10:CJNEA,#0B0H,K11//高四位为1011,数字A亮MOVKEYSBUF,#10LJMPDISPLAYK11:CJNEA,#070H,K12//高四位为0111,数字B亮MOVKEYSBUF,#11LJMPDISPLAYK12:MOVP1,#0F7H//第3行置0MOVA,P1ANLA,#0F0HCJNEA,#0E0H,K13//高四位为1110,数字C亮M