ORG 0000H ; 闪烁 流水灯
AJMP MIN0
ORG 0050H
MIN0: MOV R0,#00H
MOV DPTR,#TAB
DD1: MOV A, R0
MOV R2, #10 ; 闪烁次数
MOVC A,@A+DPTR
DD2: MOV P1, A
ACALL DELAY1
MOV P1, #0FFH
ACALL DELAY1
DJNZ R2, DD2
INC R0
CJNE R0, #08H, DD1
JMP MIN0
DELAY1: MOV R5,#2 ; 延时时间可以改
D1: MOV R6,#100
D2: MOV R7,#250
D3: DJNZ R7,D3
DJNZ R6,D2
DJNZ R5,D1
RET
TAB: DB 0FEH,0FDH,0FBH,0F7H,0EFH,0DFH,0BFH, 7FH
END
LED EQU 30H
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP T0ISR
ORG 0030H
MAIN:
MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0B0H
SETB TR0
SETB ET0
SETB EA
MOV LED,#0FEH
MOV R2,#0
CLR 00H
SJMP $
T0ISR:
CLR TR0
MOV TH0,#3CH
MOV TL0,#0B0H
SETB TR0
CPL 00H
JB 00H,T0ISR1
MOV P0,LED
MOV A,LED
RL A
INC R2
MOV A,R2
CJNE A,#4,T0ISR2
MOV R2,#0
MOV LED,#0FEH
T0ISR2:
RETI
T0ISR1:
MOV P0,#0FFH
RETI
定时器会用,流水灯程序会写,就好办了,自己想想吧。这么简单的东西,靠自己会有成就感的。