ORG 0000H
DATAR0 EQU 50H
LJMP MAIN
ORG 000BH
LJMP T0P
ORG 0100H
MAIN : MOV SP , #60H ;设置中断指针
MOV TMOD,#01H ;设置定时/计数器 T0 为工作方式 1、定时
MOV TL0 ,#0D0H ;设置定时常数
MOV TH0 ,#80H
SETB TR0
SETB ET0
SETB EA
MOV DPTR,#3000H ;设置第三通道地址
MOVX @DPTR,A
LOOP: LCALL DATA1
LCALL DISPLAY
SJMP LOOP
T0P: MOV TL0,#0D0H ;重新设置定时常数
MOV TH0,#80H
MOV DPTR,#3000H ;将第三通道地址送 DPTR
MOVX A,@DPTR
MOV DATAR0,A
MOVX @DPTR,A
RETI
DATA1:
MOV 79H,#03H
MOV 7AH,#11H
MOV A,DATAR0
ANL A,#0F0H
SWAP A
MOV 7BH,A
MOV A,DATAR0
ANL A,#0FH
MOV 7CH,A
RET
DISPLAY:
MOV R0,#79H ;显示缓冲区首地址送 R0
MOV R3,#01H ;字位码送 R3 保存
MOV A,R3
LD0: MOV P2,A
MOV A,@R0
MOV DPTR,#TAB1 ;表首地址送 DPTR
MOVC A,@A+DPTR
DIR1: MOV P0,A
ACALL DL11
INC R0
MOV A,R3
JB ACC.5,LD1
RL A
MOV R3,A
AJMP LD0
LD1: RET
TAB1: DB 0C0H,0F9H,0A4H,0B0H,99H,92H
DB 82H,0F8H,80H,90H,88H,83H,0C6H,0A1H
DB 86H,8EH,0BFH,0FFH,0FFH
DL11: MOV R7,#02H
DL: MOV R6,#0FFH
DL6: DJNZ R6,DL6
DJNZ R7,DL
RET
END
ORG 0000H
LJMP MAIN
ORG 000BH
AJMP LOOP
ORG 001BH
AJMP LOOP1
ORG 0030H
MAIN:MOV SP,#60H
MOV DPTR,#7FFFH
MOV TMOD,#11H
MOV TH0,#3CH
MOV TL0,#0B0H
MOV TH1,#3CH
MOV TL1,#0B0H
SETB EA
SETB ET0
SETB ET1
SETB TR0
SJMP $
LOOP:MOV A,#0F2H
MOVX @DPTR,A
CLR TR0
MOV TH0,#3CH
MOV TL0,#0B0H
SETB TR1
RETI
LOOP1:MOV A,#01H
MOVX @DPTR,A
CLR TR1
MOV TH1,#3CH
MOV TL1,#0B0H
SETB TR0
RETI
END