|
ORG 0000H
MOV A,#6
MOV R2,#6
MOV R0,#70H
LOOP: MOV @R0,A
DEC A
DJNZ R2,LOOP
LCALL DISPLAY
MAIN:LCALL KEY
LJMP MAIN
KEY: ORL P1,#00111100B
MOV A,P1
ORL A,#11000011B
CPL A
JZ NO_KEY
LCALL DELAY
MOV A,P1
ORL A,#11000011B
CPL A
JZ NO_KEY
JNB ACC.2,N_KEY
LCALL KEY1F ;1#键
LJMP NO_KEY
N_KEY1:JNB ACC.3,N_KEY2
LCALL KEY1F
LJMP NO_KEY
N_KEY2: JNB ACC.4,N_KEY3
LCALL KEY3F
LJMP NO_KEY
N_KEY3:JNB ACC.5,N_KEY4
LCALL KEY4F
LJMP NO_KEY
KEY1F: MOV 70H,#1
LCALL DISPLAY
RET
KEY2F: MOV 71H,#2
LCALL DISPLAY
RET
KEY3:MOV 72H,#3
LCALL DISPLAY
RET
KEY4:MOV 73H,#4
LCALL DISPLAY
NO_KEY:RET
END
|
|