(老师,这个程序二紧接着程序一)
;显示70H到74H中的数值
MOV R0,#70H
;显示70H中的数值
LOOP1:
MOV A,@R0
MOV DPTR,#LEDCODE
MOVC A,@A+DPTR
MOV
R2,#8
LOOP0:
RRC
A
MOV
P1.7,C
CLR
P1.6
SETB
P1.6
DJNZ R2,LOOP0
INC R0
DJNZ R3,LOOP1
SETB
P3.7
clr
p3.7
MOV R0,#71H
;显示71H中的数值
LOOP2:
MOV A,@R0
MOV DPTR,#LEDCODE
MOVC A,@A+DPTR
MOV
R2,#8
LOOP00:
RRC
A
MOV
P1.7,C
CLR
P1.6
SETB
P1.6
DJNZ R2,LOOP00
INC R0
DJNZ R3,LOOP2
SETB
P3.7
clr
p3.7
MOV R0,#72H
;显示72H中的数值
LOOP3:
MOV A,@R0
MOV DPTR,#LEDCODE
MOVC A,@A+DPTR
MOV
R2,#8
LOOP000:
RRC
A
MOV
P1.7,C
CLR
P1.6
SETB
P1.6
DJNZ R2,LOOP000
INC R0
DJNZ R3,LOOP3
SETB
P3.7
clr
p3.7
MOV R0,#73H
;显示73H中的数值
LOOP4:
MOV A,@R0
MOV DPTR,#LEDCODE
MOVC A,@A+DPTR
MOV
R2,#8
LOOP0000:
RRC
A
MOV
P1.7,C
CLR
P1.6
SETB
P1.6
DJNZ R2,LOOP0000
INC R0
DJNZ R3,LOOP4
SETB
P3.7
clr
p3.7
MOV R0,#74H
;显示74H中的数值
LOOP5:
MOV A,@R0
MOV DPTR,#LEDCODE
MOVC A,@A+DPTR
MOV
R2,#8
LOOP00000:
RRC
A
MOV
P1.7,C
CLR
P1.6
SETB
P1.6
DJNZ R2,LOOP00000
INC R0
DJNZ R3,LOOP5
SETB
P3.7
clr
p3.7
ret
LEDCODE:db 0d7h,12h,5dh,5bh,9ah,0cbh,0cfh,13h,0dfh,0dbh
INET1P:
;定时50ms
CLR TR0
CLR TR1
MOV R2,TH0
MOV R3,TL0
MOV TH1,#4CH
MOV TL1,#00H
MOV TH0,#0
MOV TL0,#0
SETB TR1
SETB TR0
RETI
;判断是否够减子程序,结果在C中,C=0够减;C=1不够减
COM_SUB:
MOV A,R2;传高8位
CJNE A,7DH,COM_END;高8位不相等
MOV A,R3;高8位相等,传低8位
CJNE A,7CH,COM_END
COM_END:
RET
;双字节数的减法子程序,差还回到被减数的单元中
SUBWORD:
CLR C
MOV A,R3
SUBB A,7CH
MOV R3,A
MOV A,R2
SUBB A,7DH
MOV R2,A
RET
END
|