|
今天参照别人的思路写了一个单片机秒表的现实是00.00-99.99可是仿真出来却只有两位现实。。其他两两位不显示。。程序贴出来大家帮我看看那里有问题,帮助改正一下谢谢了
ORG 0000H
LJMP 0030H
ORG 001BH
LJMP 1000H
ORG 0030H
MOV TH1,#0D8H
MOV TL1,#0F0H
MOV IE,#88H
SETB TR1
MOV 50H,#00H
MOV 51H,#00H
MOV 52H,#00H
MOV 53H,#00H
HERE: LCALL LD0
LJMP HERE
ORG 1000H
MOV TH1,#0D8H
MOV TL1,#0F0H
INC 50H
MOV R0,#50H
CJNE @R0,#10,LOOP
INC 51H
MOV 50H,#00H
INC R0
CJNE @R0,#10,LOOP
INC 52H
MOV 51H,#00H
INC R0
CJNE @R0,#10,LOOP
INC 53H
MOV 52H,#00H
INC R0
CJNE @R0,#10,LOOP
MOV 53H,#00H
loop: RETI
LD0: MOV R3,#0F7H
MOV R4,#04H
MOV R1,#50H
KK: MOV A,R3
MOV P2,A
MOV DPTR,#TAB
MOV A,@R1
MOVC A,@A+DPTR
DIR1:MOV P0,A
ACALL DL1
INC R1
MOV A,R3
RR A
MOV R3,A
DJNZ R4,KK
RET
TAB:DB 0C0H,0F9H,0A4H,0B0H,99H
DB 92H,82H,0F8H,80H,90H
DL1: MOV R7,#02H
DL: MOV R6,#0FFH
NOP
NOP
DL6: DJNZ R6,DL6
DJNZ R7,DL
RET
|
|