试试下列程序:
ORG 0000H
JMP START
ORG 000BH
JMP T0_INT
;------------------------------
START:
MOV TMOD, #06H
MOV TH0, #255
MOV TL0, #255
MOV IE, #82H
SETB TR0
MOV R2, #0
MOV R3, #0
MOV DPTR, #TAB
;------------------------------
M_LOOP:
MOV A, R3
MOVC A, @A + DPTR
MOV P2, A
MOV A, R2
MOVC A, @A + DPTR
MOV P0, A
SJMP M_LOOP
;------------------------------
T0_INT:
JNB P3.4, T0_INT
INC R3
CJNE R3, #10, T0_END
MOV R3, #0
INC R2
CJNE R2, #10, T0_END
MOV R2, #0
T0_END:
RETI
;------------------------------
TAB: DB 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f
;------------------------------
END
请尝试以下步骤:
ORG 0000H
JMP START
ORG 000BH
的JMP T0_INT
; --------------- ---------------
START:
MOV TMOD,#06H
MOV TH0,#255
MOV TL0,#255 /> MOV IE,#82H
SETB TR0
MOV R2,#0
MOV R3,#0
MOV DPTR,#TAB
; ----- -------------------------
M_LOOP:
MOV A,R3
MOVC A,@ A + DPTR MOV P2,A
MOV A,R2
MOVC A,@ A + DPTR
MOV P0,一个
SJMP M_LOOP
---- --------------------------
T0_INT:
JNB P3.4,T0_INT
INC R3 /> CJNE R3,#10,T0_END的
MOV R3,#0
INC R2
CJNE R2,#10,T0_END
MOV R2,#0
T0_END: RETI
; ------------------------------
TAB:DB 0x3f ,0X06,0x5b,0x4f,0x66,0x6d,0x7d,为0x07,到0x7f,0x6f
-------------------------------------------------------------------------------- ---
END
COUNT EQU 30H
ORG 0000H
LJMP MAIN
ORG 0003H
LJMP EX0ISR
ORG 000BH
LJMP T0ISR
ORG 0030H
MAIN:
MOV SP,#5FH
MOV TMOD,#06H
MOV TH0,#0FFH
MOV TL0,#0FFH
SETB ET0
SETB EX0
SETB EA
SETB IT0
SETB TR0
MOV P0,#00H
MOV P2,#00H
MOV COUNT,#0
LOOP:
MOV DPTR,#LEDTAB
MOV A,COUNT
ADD A,#0
DA A
PUSH ACC
ANL A,#0F0H
SWAP A
MOVC A,@A+DPTR
MOV P0,A
POP ACC
ANL A,#0FH
MOVC A,@A+DPTR
MOV P2,A
SJMP LOOP
EX0ISR:
MOV COUNT,#0
RETI
T0ISR:
INC COUNT
MOV A,COUNT
CJNE A,#100,T0ISR1
MOV COUNT,#0
T0ISR1:
RETI
LEDTAB:
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH,00H
END