Similar to the usage of MCU registers, when using 1602 LCD, we must first perform initial function configuration. There are several instructions for 1602 LCD that need to be understood.
1)
Write instruction 0x38 to set the display mode, set 16x2 display, 5x7 dot matrix, 8-bit data interface. This instruction is fixed for our LCD, and 0x38 must be written. If you look carefully, you will find that our LCD actually has an internal dot matrix of 5x8. Some 1602 LCDs are also compatible with serial communication, which can be done with 2 IO ports, but the speed is slow. Our LCD is fixed to 0x38 mode.
2) Display on/off and cursor setting instructions
There are 2 instructions here. The first instruction has 8 bits in a byte, of which the upper 5 bits are fixed to 0b00001, and the lower 3 bits are represented by DCB from high to low. D=1 means display on, D=0 means display off; C=1 means display cursor, C=0 means no display cursor; B=1 means cursor blinking, B=0 means cursor not blinking.
The second instruction has 6 upper bits fixed to 0b000001, and the lower 2 bits are represented by NS from high to low. N=1 means that after reading or writing a character, the pointer automatically increases by 1 and the cursor automatically increases by 1. N=0 means that after reading or writing a character, the pointer automatically decreases by 1 and the cursor automatically decreases by 1. S=1 means that after writing a character, the entire screen display moves left (N=1) or right (N=0) to achieve the effect of the cursor not moving but the screen moving, just like the effect of our calculator input, and S=0 means that after writing a character, the entire screen display does not move.
3) The clear screen instruction
is fixed. Writing 0x01 means clearing the screen, which includes clearing the data pointer and all displays. Writing 0x02 means only clearing the data pointer, but not the display.
4) RAM address setting instruction
The highest bit of the instruction code is 1, and the lower 7 bits are the RAM address. The relationship between the RAM address and the characters on the LCD is shown in Figure 12-2 above. Usually, we have to set the address before reading and writing data, and then perform data reading and writing operations.
Previous article:Introduction to the read and write timing of 1602 LCD
Next article:MCU communication timing analysis
Recommended ReadingLatest update time:2024-11-16 14:31
- Popular Resources
- Popular amplifiers
- Single-chip microcomputer C language programming and simulation
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Principles and Applications of Single Chip Microcomputers and C51 Programming (3rd Edition) (Xie Weicheng, Yang Jiaguo)
- stm32+lcd1602 example
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
- EEWORLD University ---- Live Replay: Microchip Security Series 10 - Automotive Cybersecurity
- Appearance characteristics of chip resistors
- Has anyone used a 15v to 3.3v converter?
- When low EMI power supplies meet crowded circuit boards, what do you do?
- EEWORLD University ---- OpenCV 3 with Python 3 Tutorial
- Siemens 230RC opens for 3 seconds and closes for 3 seconds
- Stack Overflow Technology from Entry to Mastery
- Design of Automatic AC Voltage Stabilizer
- Competition control competition materials and excellent works sharing
- NUCLEO_G431RB Review (1) Compilation Environment Settings