Using 51 MCU to Realize the Display of Button Controlled Light
Article Directory
Topic restatement
Programming realizes button control of single nixie tube. The digital tube uses P0, and the keyboard uses P3.0, P3.1, P3.2, P3.3. Press button K1, the digital tube displays 1; press button K2, the digital tube displays 2, and so on.
Problem analysis and solution ideas
To be improved (please wait patiently)
code
ORG 0000H
MOV P0,#00000000B
WLL:
JNB P3.0,W1
JNB P3.1,W2
JNB P3.2,W3
JNB P3.3,W4
LJMP WLL
W1:MOV P0,#00000110B
LCALL AA
LJMP WLL
W2:MOV P0,#01011011B
LCALL AA
LJMP WLL
W3:MOV P0,#01001111B
LCALL AA
LJMP WLL
W4:MOV P0,#01100110B
LCALL AA
LJMP WLL
AA: MOV R5,#10
START:MOV R6,#100
NEXT1:MOV R7,#250
NEXT2:DJNZ R7,NEXT2
DJNZ R6,NEXT1
DJNZ R5,START
RET
END