ORG 0000H
JMP START
start_key EQU P2^3
reset_key EQU P2^6
led_port EQU P1
;//////////////////////////////////////
START: MOV R4,#0FFH
MOV R5,#08
CLR C
JB start_key, start
LCALL DELAY2
JB start_key, start
JNB START_KEY,$
L1: MOV A,R4
RLC A
MOV LED_PORT,A
MOV R4,A
JNB reset_key, stop
LCALL DELAY
DJNZ R5,L1
MOV R5,#07
L2: RRC A
MOV LED_PORT,A
MOV R4,A
JNB reset_key, stop
LCALL DELAY
DJNZ R5,L2
MOV R5,#07
MOV 20H,#00
MOV DPTR,#TAB
L3: MOV A,20H
MOVC A,@A+DPTR
MOV LED_PORT,A
JNB reset_key, stop
LCALL DELAY
INC 20H
DJNZ R5,L3
MOV R4,#0FFH
MOV R5,#08
CLR C
JMP L1
stop: MOV LED_PORT,#0FFH
JMP START
;////////////////////////////////////////
DELAY: MOV R6,#3
DELAY0: MOV R2,#150
DELAY1: MOV R3,#248
DJNZ R3,$
DJNZ R2,DELAY1
DJNZ R6,DELAY0
RET
/////////////////////////////////////////
DELAY2: MOV R7,#20
DELAY3: MOV R1,#248
DJNZ R1,$
DJNZ R7,DELAY3
RET
;///////////////////////////////////////
TAB: DB 07EH,0BDH,0DBH,0E7H,0DBH,0BDH,07EH
END
JMP START
start_key EQU P2^3
reset_key EQU P2^6
led_port EQU P1
;//////////////////////////////////////
START: MOV R4,#0FFH
MOV R5,#08
CLR C
JB start_key, start
LCALL DELAY2
JB start_key, start
JNB START_KEY,$
L1: MOV A,R4
RLC A
MOV LED_PORT,A
MOV R4,A
JNB reset_key, stop
LCALL DELAY
DJNZ R5,L1
MOV R5,#07
L2: RRC A
MOV LED_PORT,A
MOV R4,A
JNB reset_key, stop
LCALL DELAY
DJNZ R5,L2
MOV R5,#07
MOV 20H,#00
MOV DPTR,#TAB
L3: MOV A,20H
MOVC A,@A+DPTR
MOV LED_PORT,A
JNB reset_key, stop
LCALL DELAY
INC 20H
DJNZ R5,L3
MOV R4,#0FFH
MOV R5,#08
CLR C
JMP L1
stop: MOV LED_PORT,#0FFH
JMP START
;////////////////////////////////////////
DELAY: MOV R6,#3
DELAY0: MOV R2,#150
DELAY1: MOV R3,#248
DJNZ R3,$
DJNZ R2,DELAY1
DJNZ R6,DELAY0
RET
/////////////////////////////////////////
DELAY2: MOV R7,#20
DELAY3: MOV R1,#248
DJNZ R1,$
DJNZ R7,DELAY3
RET
;///////////////////////////////////////
TAB: DB 07EH,0BDH,0DBH,0E7H,0DBH,0BDH,07EH
END