求哪个老师解答下啊,是不是我这P0口接的不对啊,反正每次遇到这种P0口分时复用就不行了,查了好多东西不知道哪里错了
ORG 0000H
START: MOV SP,#53h
MOV DPTR,#0B001H
MOV A,#00H
MOVX @DPTR,A
MOV A,#32H
MOVX @DPTR,A
MOV A,#0DFH
MOVX @DPTR,A
MOV R7,#10H
DIS_P: MOVX A,@DPTR
JB ACC.7,DIS_P
DJNZ R7,DIS_P
MOV DPTR,#0B000H
MOV A,#0C8H
MOVX @DPTR,A
INC DPTR
MOV A,#80H
MOVX @DPTR,A
BUF: MOV 30H,#80H
MOV 31H,#40H
KEY: MOV DPTR,#0B001H
MOVX A,@DPTR
ANL A,#07H
CJNE A,#00H,VALUE
AJMP KEY
VALUE: MOV DPTR,#0B000H
MOVX A,@DPTR
MOV B,A
MOV R1,#00H
MOV DPTR,#KEYTAB
NUM: MOV A,#00H
MOVC A,@A+DPTR
CJNE A,B,NEXT
AJMP DIS_NUM
NEXT: INC DPTR
INC R1
MOV A,R1
JB ACC.4,HUAN
AJMP NUM
HUAN: MOV R1,#00H
MOV DPTR,#KEYTAB1
FUNC: MOV A,#00H
MOVC A,@A+DPTR
CJNE A,B,NEXT1
AJMP DIS_FUNC
NEXT1: INC DPTR
INC R1
MOV A,R1
JNB ACC.2,FUNC
LJMP START
DIS_NUM:MOV A,30H
MOV DPTR,#0B001H
MOVX @DPTR,A
MOV A,R1
MOV R0,31H
MOV @R0,A
INC 31H
MOV DPTR,#CDATA
MOVC A,@A+DPTR
MOV DPTR,#0B000H
MOVX @DPTR,A
INC 30H
MOV A,30H
CJNE A,#88H,J1
LJMP BUF
J1: AJMP KEY
DIS_FUNC: MOV DPTR,#FUNCJ
MOV A,R1
RL A
ADD A,R1
JMP @A+DPTR
FUNCJ: LJMP LOOP0
LJMP LOOP1
LJMP LOOP2
KEYTAB: DB 0C1H,0C8H,0C9H,0D0H,0D8H,0E0H,0C2H,0CAH,0D1H,0D9H
DB 0DAH,0C3H,0CBH,0D2H,0D3H,0DBH
KEYTAB1:DB 0E3H,0E2H,0E1H
CDATA: DB 0CH,9FH,4AH,0BH,99H,29H,28H,8FH,08H,09H
DB 88H,38H,6CH,1AH,68H,0E8H
LOOP0: MOV R5,#0CH
LJMP DISPC
LOOP1: MOV R5,#9FH
LJMP DISPC
LOOP2: MOV R5,#4AH
DISPC: MOV R6,#80H
DISPC1: MOV A,R6
MOV DPTR,#0B001H
MOVX @DPTR,A
MOV A,R5
MOV DPTR,#0B000H
MOVX @DPTR,A
MOV R2,#20H
LCALL DELAY
MOV A,#0FFH
MOVX @DPTR,A
INC R6
CJNE R6,#88H,DISPC1
AJMP DISPC
DELAY: PUSH 02H
DELAY1: PUSH 02H
DELAY2: PUSH 02H
DELAY3: DJNZ R2,DELAY3
POP 02H
DJNZ R2,DELAY2
POP 02H
DJNZ R2,DELAY1
POP 02H
DJNZ R2,DELAY
RET
END
|