;lcd display program
RS BIT P2.6
R_W BIT P2.5
ENABLE BIT P2.7
LCDDATA DATA P1
;******************************************
ORG 0000H
AJMP MAIN
;ORG 000BH
;AJMP INSERS
ORG 0050H
MAIN:
;MOV TMOD,#00H
;MOV TL0,#00H
;MOV TH0,#00H
;SETB EA
;SETB ET0
;SETB TR0
;MOV R5,#50
;CLR P3.2
;SETB P3.1
MOV SP,#60H
START:
LCALL INITIAL
MOV A,#10000000B
LCALL WRITE_INSTRUCTION
MOV DPTR,#TAB
LCALL KEY
MOVC A,@A+DPTR
LCALL WRITELCDDATA
AJMP START
;INSERS:
;MOV TL0,#00H
;MOV TH0,#00H
;DJNZ R5,L0
;MOV R5,#50
;CPL P3.2
;CPL P3.1
;L0:
;RETI
INITIAL:
MOV A,#00111000B
LCALL WRITE_INSTRUCTION
MOV A,#00001110B
LCALL WRITE_INSTRUCTION
MOV A,#00000110B
LCALL WRITE_INSTRUCTION
RET
CHECKBUSY:
PUSH ACC
CHECKBUSYLOOP:
CLR ENABLE
SETB R_W
CLR RS
SETB ENABLE
MOV A,LCDDATA
CLR ENABLE
JB ACC.7,CHECKBUSYLOOP
POP ACC
LCALL DELAY1
RET
WRITE_INSTRUCTION:
LCALL CHECKBUSY
CLR ENABLE
CLR R_W
CLR RS
SETB ENABLE
MOV LCDDATA,A
CLR ENABLE
RET
WRITELCDDATA:
LCALL CHECKBUSY
CLR ENABLE
CLR R_W
SETB RS
SETB ENABLE
MOV LCDDATA,A
CLR ENABLE
RET
DELAY1:
MOV R5,#05H
L4:
MOV R6,#0F8H
L5:
DJNZ R6,L5
DJNZ R5,L4
RET
KEY: LCALL KS
JNZ K1
LCALL DELAY2
AJMP KEY
K1: LCALL DELAY2
LCALL DELAY2
LCALL KS
JNZ K2
AJMP KEY
K2: MOV R2,#0DFH
MOV R4,#00H
K3: MOV P3,R2
L6: JB P3.0,L1
MOV A,#00H
AJMP LK
L1: JB P3.1,L2
MOV A,#03H
AJMP LK
L2: JB P3.2,L3
MOV A,#06H
AJMP LK
L3: JB P3.3,NEXT
MOV A,#09H
LK: ADD A,R4
PUSH ACC
K4: LCALL DELAY2
LCALL KS
JNZ K4
POP ACC
RET
NEXT:
INC R4
MOV A,R2
JNB ACC.7,KEY
RL A
MOV R2,A
AJMP K3
KS: MOV P3,#0FH
MOV A,P3
XRL A,#0FH
RET
DELAY2:
MOV R5,#4AH
L7: MOV R6,#0FAH
L8: DJNZ R6,L8
DJNZ R5,L7
RET
TAB:DB 31H,32H,33H,34H,35H,36H,37H,38H,39H
DB 41H,30H,42H
END
Previous article:1602 LCD screen driver source program 1
Next article:Design of low-cost data acquisition device based on C8051F340
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Smart LED Octahedron
- [Lazy self-care fish tank control system] BLE_MESH fish tank light peripheral production
- Verilog001
- Inter-core Communication Method of TMS320C6678 Multi-core DSP
- How to implement the logic of GD32E230 OAT? Is there any relevant code information?
- Microelectronic Circuit Design (4th Edition, English)
- MAX202 RS-232 Interface Counterfeit Device Warning
- RC π type filter resistor and capacitor value -------
- About the role of capacitors in suppressing differential mode interference and common mode interference
- [Raspberry Pi Pico Review] WS2812B full-color LED light strip/ring display driver