大侠好,我用keil编写的汇编程序中CJNE 语句好像无效,在调试时,R2的值变化,但R1,R0的值不变,程序如下:
ORG 0000H
LJMPSTART
ORG 000BH
LJMP TIME0
ORG30H
START: MOV DPTR,#TAB1
MOV TMOD,#01H
MOV TH0,#0EFH
MOV TL0,#0FFH
SETB EA
SETB ET0
MOV R0,#00H
MOV R1,#00H
MOV R2,#00H
SETB TR0
ZHU: LCALL XIANSHI
LJMPZHU
DELAY:MOV09H,08H
D: MOV 0AH,#255
DJNZ 0AH,$
DJNZ 09H,D
RETI
XIANSHI:SETB P1.0
MOV A,R0
MOVC A,@A+DPTR
MOV P2,A
MOV 08H,#40H
LCALL DELAY
CLR P1.0
SETB P1.1
MOV A,R1
MOVC A,@A+DPTR
MOV P2,A
LCALL DELAY
CLR P1.1
RETI
TIME0: PUSH ACC
PUSH PSW
MOV TH0,#0EFH
MOV TL0,#0FFH
INC R2
CJNE R2,#0FH,ENDD 这里似乎不执行,
MOV R2,#0
INC R0
CJNE R0,#0AH,ENDD 这里似乎不执行,
MOV R0,#00H
INC R1
CJNE R1,#0AH,ENDD
MOV R1,#00H
ENDD: POP PSW
POP ACC
RETI
TAB1:
DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H,080H,090H
END
|