CLR A
MOV P2,#00H
UP: MOV P1,A
SETB P3.0
LCALL KEYPD
LCALL DISP
SJMP UP
DISP:
MOV A,R5
ANL A,#0FH
MOV DPTR,#SEVEN_SEG
MOVC A,@A+DPTR
MOV P1,A
RET
KEYPD:
MOV R4,#0FEH
MOV R6,#04
MOV R5,#00H
NEXTRW:
MOV P2,04H
MOV A,P2
XRL A,R4
JNZ ROW
MOV A, R5
ADD A,#04H
MOV R5,A
MOV A,R4
RL A
MOV R4,A
DJNZ R6,NEXTRW
LJMP KEYPD
ROW: MOV A,P2
ANL A,#0F0H
SWAP A
REDO:
RRC A
JNC KEY
INC R5
SJMP REDO
KEY: MOV 0A0H,#0F0H
MOV A,0A0H
XRL A,#0F0H
JNZ KEY
MOV A,R5
RET
SEVEN_SEG:DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,5FH,7CH,39H,5EH,7BH,71H
END
Comments
Post a Comment