Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
1, microcontroller AT89C51 P2 port connected to eight light-emitting diodes, so that the eight light-emitting diodes show flashing function, that is, eight lights on 2S, 3S off, so the cycle.
Reference program
ORG 0000H
Start: MOV P1, #0H
CALL delay
MOV P1, #0FFH
CALL delay
CALL delay
LJMP start
Delay:
MOV R7, #200
D2: MOV R6, #250
D1: DJNZ R6,d1
DJNZ R7,d2
RET
END
;200*250 times*2*1us=1000ms=1s
MCU flashing light assembly language source code (2)MCU AT89C51 P2 port connected to 8 light-emitting diodes, so that the 8 light-emitting diodes interact flashing 5 times, and then double-lamp after the left shift and then double-right shift, so the cycle, the effect of forming a water lamp, delay 0.5S.
ORG 0000H
MOV R0, #5
Start:
MOV P1, #10101010B
CALL delay
MOV P1, #01010101B
CALL delay
DJNZ R0,start
MOV R0, #5
MOV A, #11111100B
S1: MOV P1, A
CALL delay
RL A
RL A
CJNE A, #11111100B, s1
S2: RR A
RR A
MOV P1, A
CALL delay
CJNE A, #11111100B, s2
JMP start
Delay: MOV R5, #100
K1: MOV R6, #250
K2: MOV R7, #250
K3: DJNZ R7,k3
DJNZ R6,k2
DJNZ R5,k1
RET
END
MCU flashing light assembly language source code (3)P2.0, P2.1 and P2.2 of the one-chip computer AT89C51 are connected to the button switches PB1, PB2 and PB3 respectively; P1.0 is connected to one LED. Press PB1, the LED is on; press PB2 the LED is off; press PB3 the LED flashes. The delay is 0.1S.
Reference procedure:
ORG 0000H
MOV P2, #0FFH
S1: JNB P2.0,s3
JNB P2.1, s2
JNB P2.2, s4
JMP s1
S2: SETB P1.0
JMP s1
S3: CLR P1.0
JMP s1
S4: SETB P1.0
CALL delay
CLR P1.0
CALL delay
JNB P2.0, s3
JNB P2.1, s2
JMP s4
Delay: MOV R5, #100
K1: MOV R6, #250
K2: MOV R7, #250
K3: DJNZ R7,k3
DJNZ R6,k2
DJNZ R5,k1
RET
END
MCU flashing light assembly language source code (4)P2.0, P2.1 and P2.2 of the one-chip computer AT89C51 are connected to the button switches PB1, PB2 and PB3, respectively; the P1 port is connected to 8 LEDs. Press PB1, 8 LEDs flash; press PB2 to move 8 LEDs to the right; press PB3 to move 8 LEDs to the left. The delay is 0.1S.
Source code:
ORG 0
MOV P2, #0FFH
LOOP: JNB P2.0, LOOP_1
JNB P2.1, LOOP_2
JNB P2.2, LOOP_3
JMP LOOP
LOOP_1: MOV R0, #2
LOOP_1_1: MOV A, #10101010B
MOV P0,A
CALL D100MS
MOV A, #01010101B
MOV P0,A
CALL D100MS
MOV P0, #11111111B
DJNZ R0, LOOP_1_1
LOOP_1_2: JB P2.0, LOOP
JMP LOOP_1_2
LOOP_2: MOV A, #11111110B
MOV R0, #8
LOOP_2_1: MOV P0,A
RL A
CALL D100MS
DJNZ R0, LOOP_2_1
MOV P0, #11111111B
LOOP_2_2: JB P2.1, LOOP
JMP LOOP_2_2
LOOP_3: MOV A, #01111111B
MOV R0, #8
LOOP_3_1: MOV P0,A
RR A
CALL D100MS
DJNZ R0, LOOP_3_1
MOV P0, #11111111B
LOOP_3_2: JB P2.2, LOOP
JMP LOOP_3_2
D100MS: MOV R7, #250
D1: MOV R6, #200
DJNZ R6, $
DJNZ R7, D1
RET
END
Author:
Ms. Sandy
Phone/WhatsApp:
+8618550184339
March 15, 2023
February 07, 2023
Bu tedarikçi için e-posta
Author:
Ms. Sandy
Phone/WhatsApp:
+8618550184339
March 15, 2023
February 07, 2023
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
Fill in more information so that we can get in touch with you faster
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.