参考程序清单如下:
ORG 0000H
MOV R5,#00H
MOV R6,#05H
MAIN:MOV A,#03H
MOV DPTR,#0FF20H
MOVX @DPTR,A
MOV A,#00H
MOV DPTR,#0FF21H
MOVX @DPTR,A
LT1: MOV R4,#21H
MOV R7,#32H
SJMP LT0
LT2:MOV R4,#0CH
MOV R7,#32H
LT0: MOV P1,R4
DIR: MOV 79H,R5
MOV 7AH,R6
MOV R0,#79H
MOV R3,#01H
MOV R1,#07H
LD0: MOV R2,#7FH
LD1: MOV A,@R0
MOV DPTR,#SEG
MOVC A,@A+DPTR
MOV DPTR,#0FF22H
MOVX @DPTR,A
MOV DPTR,#0FF21H
MOV A,R3
MOVX @DPTR,A
MOV 4FH,#0FFH
LOOP3:DJNZ 4FH,LOOP3
CJNE A,#01H,LD2
MOV A,#02H
MOV R3,A
INC R0
SJMP LD1
LD2: MOV A,#01H
MOV R3,A
MOV R0,#79H
DJNZ R2,LD1
DJNZ R1,LD0
DEC R7
LCALL BCD
MOV R3,B
MOV A,#0FH
ANL A,R3
MOV R5,A
LCALL BCD
MOV R3,A
MOV A,#0FH
ANL A,R3
MOV R6,A
LOOP1:MOV A,R7
JZ LOOP2
SJMP LT0
LOOP2:CJNE R4,#21H,LT1
SJMP LT2
BCD: MOV B,#0AH
MOV A,R7
DIV AB
RET
SEG:DB 0C0H,0F9H,0A4H,0B0H,99H
DB 92H,82H,0F8H,80H,90H
END
此帖出自
小平头技术问答
一周热门 更多>