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

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

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

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

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

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

方法一、 ORG0000H LJMPMAIN ORG0100H MAIN: MOVP1,#0F0H//P1口设初值F0,矩阵按键高四位置1,低四位置0, JNBP1.4,Y0 //用JNB检测按键端口,P1.4口低电平跳转 Y0 JNBP1.5,Y1 JNBP1.6,Y2 JNBP1.7,Y3 SJMPMAIN Y0: MOV30H,#00H MOVP1,#0EFH JNBP1.4,X0 MOVP1,#0DFH JNBP1.4,X1 MOVP1,#0BFH JNBP1.4,X2 MOVP1,#07FH JNBP1.4,X3 Y1: MOV30H,#01H MOVP1,#0EFH JNBP1.0,X0 MOVP1,#0DFH JNBP1.1,X1 MOVP1,#0BFH JNBP1.2,X2 MOVP1,#7FH JNBP1.3,X3 Y2: MOV30H,#02H MOVP1,#0EFH JNBP1.0,X0 MOVP1,#0DFH JNBP1.1,X1 MOVP1,#0BFH JNBP1.2,X2 MOVP1,#7FH JNBP1.3,X3 Y3: MOV30H,#03H MOVP1,#0EFH JNBP1.0,X0 MOVP1,#0DFH JNBP1.1,X1 MOVP1,#0BFH JNBP1.2,X2 MOVP1,#7FH JNBP1.3,X3 X0: MOV31H,#00H ACALLDELAY MOVP1,#0F0H LJMPJISUAN X1: MOV31H,#01H ACALLDELAY MOVP1,#0F0H LJMPJISUAN X2: MOV31H,#02H ACALLDELAY MOVP1,#0F0H LJMPJISUAN X3: MOV31H,#03H ACALLDELAY MOVP1,#0F0H LJMPJISUAN JISUAN: MOVA,31H MOVB,#04H MULAB ADDA,30H MOVDPTR,#TAB MOVCA,@A+DPTR MOVP0,A CC: MOVA,P1 ANLA,#0F0H XRLA,#0F0H JNZCC LCALLMAIN DELAY: MOVR4,#0C5H D1: MOVR5,#43H D0: MOVR6,#10H DJNZR6,$ DJNZR5,D0 DJNZR4,D1 RET TAB: DB0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07 DB0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71 方法二、 ORG0000H LJMPSTART KEYSBUFEQU30H ORG0100H START:MOVP1,#0F0H MOVA,P1 ANLA,#0F0H XRLA,#0F0H JZSTART LCALLDELAY MOVP1,#0F0H MOVA,P1 ANLA,#0F0H XRLA,#0F0H JZSTART MOVP1,#0FEH //第0行置0 CLRP1.0 MOVA,P1 ANLA,#0F0H //与逻辑,高位保留 CJNEA,#0E0H,K1//高四位为1110,数字0亮 MOVKEYSBUF,#0 LJMPDISPLAY K1:CJNEA,#0D0H,K2//高四位为1101,数字1亮 MOVKEYSBUF,#1 LJMPDISPLAY K2:CJNEA,#0B0H,K3// 高四位为1011,数字2亮 MOVKEYSBUF,#2 LJMPDISPLAY K3:CJNEA,#070H,K4//高四位为0111,数字3亮 MOVKEYSBUF,#3 LJMPDISPLAY K4:MOVP1,#0FDH //第1行置0 MOVA,P1 ANLA,#0F0H CJNEA,#0E0H,K5//高四位为1110,数字4亮 MOVKEYSBUF,#4 LJMPDISPLAY K5:CJNEA,#0D0H,K6//高四位为1101,数字5亮 MOVKEYSBUF,#5 LJMPDISPLAY K6:CJNEA,#0B0H,K7// 高四位为1011,数字6亮 MOVKEYSBUF,#6 LJMPDISPLAY K7:CJNEA,#070H,K8//高四位为0111,数字7亮 MOVKEYSBUF,#