;功能简述:通过8255动态控制4位数码管,显示缓冲为31H(低)~34H(高)
;
;
ORG 0000H
LJMP MAIN
ORG 0100H
MAIN: MOV A,#89H
MOV DPTR,#7FFFH
MOVX @DPTR,A
START: ACALL SEND
DD: ACALL DISP
AJMP DD
;显示函数,显示缓存为31H(低)~34H(高)
DISP: MOV R2,#01H
MOV R5,#4
MOV R0,#31H
DSP1:
MOV DPTR,#7CFFH
MOV A,R2
MOVX @DPTR,A
MOV A,@R0
DSP2: LCALL BCD
CPL A
MOV DPTR,#7DFFH
MOVX @DPTR,A
LCALL DEL0
LCALL DEL0
MOV A,R2
RL A
MOV R2,A
INC R0
DJNZ R5,DSP1
MOV A,#0FFH
MOV DPTR,#7DFFH
MOVX @DPTR,A
RET
DEL0: MOV R6,#00H
TM: MOV R7,#00H
DJNZ R7,$
DJNZ R6,TM
RET
;把要显示的数据送到内存单元31H~34H中去,
SEND: MOV R7,#4
MOV R0,#31H
MOV A,#01H
SS: MOV @R0,A
INC A
INC R0
DJNZ R7,SS
RET
;译码
BCD: INC A
MOVC A,@A+PC
RET
DB 03FH,06H,5BH,4FH,66H,6DH,7DH,07H
DB 7FH, 6FH,77H,7CH,39H,5EH,79H,71H
END
|