Current location - Education and Training Encyclopedia - Graduation thesis - Single chip microcomputer experimental running water lamp
Single chip microcomputer experimental running water lamp
ORG OOOOH

LJMP manager

ORG 1000H

Mainly: MOV A, #OFEH

Again: MOV P 1, a

RL A

LCALL delay

JNB P 1.7, two//here, it is judged whether P 1.7 is low, and if so, it is switched to two.

SJMP again

Two: MOV A, #OFFH

MOV P 1,A

PP:MOV A,#OFEH

MOV·P2

RL A

LCALL delay

JNB P2.7, judging P2.7 by the same principle.

SJMP PP

Delay: MOV R6, #OFFH

L 1: MOV R7,#OFFH

DJNZ R7 dollars

DJNZ R6,L 1

Soak in water to soften

END has not been implemented yet, so the following ideas should be feasible. P 1 and P2 connect 16 LEDs. When the light at the highest position of P 1 lights up, it will be executed twice, starting from the lowest position of P2. When the highest position, that is, P2.7, is at a low level, it will be switched back to P 1 after the waiting time is over, and so on (here, P2 ports don't have to be all set at the beginning/.