4*4矩阵键盘汇编语言程序,按键分别显示,1,2,3,4,5,6,7,8,9,A,b,c,d,E
1个回答
2013-11-09
展开全部
ORG 00H
STRAT: MOV R4, #00H
L1: MOV R3, #0F7H
MOV R1, #00H
L2: MOV A, R3
MOV P3, A
MOV A, P3
MOV R4, A
SETB C
MOV R5, #04H
L3: RLC A
JNC KEY
INC R1
DJNZ R5, L3
MOV A, R3
SETB C
RRC A
MOV R3, A
JC L2
JMP L1
KEY: ACALL DELAY
D1: MOV A, P3
XRL A,R4
JZ D1
MOV A, R1
ACALL DISP
JMP L1
DISP: MOV DPTR, #TABLE
MOVC A, @A+ DPTR
MOV P0, A
RET
DELAY: MOV R7, #60
MOV R6, #248
DLY1: DJNZ R6, $
DJNZ R7, DLY1
RET
TABLE: DB 0C0H, 0F9H, 0A4H, 0B0H
DB 99H, 92H, 82H, 0F8H
DB 80H, 90H, 88H, 83H
DB 0C6H, 0A1H, 86H, 8EH
END89c51的,很经典,不懂的可以问我。
STRAT: MOV R4, #00H
L1: MOV R3, #0F7H
MOV R1, #00H
L2: MOV A, R3
MOV P3, A
MOV A, P3
MOV R4, A
SETB C
MOV R5, #04H
L3: RLC A
JNC KEY
INC R1
DJNZ R5, L3
MOV A, R3
SETB C
RRC A
MOV R3, A
JC L2
JMP L1
KEY: ACALL DELAY
D1: MOV A, P3
XRL A,R4
JZ D1
MOV A, R1
ACALL DISP
JMP L1
DISP: MOV DPTR, #TABLE
MOVC A, @A+ DPTR
MOV P0, A
RET
DELAY: MOV R7, #60
MOV R6, #248
DLY1: DJNZ R6, $
DJNZ R7, DLY1
RET
TABLE: DB 0C0H, 0F9H, 0A4H, 0B0H
DB 99H, 92H, 82H, 0F8H
DB 80H, 90H, 88H, 83H
DB 0C6H, 0A1H, 86H, 8EH
END89c51的,很经典,不懂的可以问我。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询