1. Introduction to LCD1602 Liquid Crystal Module
What does LCD1602 mean? LCD stands for Liquid Crystal Display, and 1602 means that 16 characters can be displayed in one line, and there are two lines in total. The actual picture is as follows:
2. Thinking Analysis
LCD1602 is a display module, and its main function is of course display. Since it is a display, we can think about it, it is nothing more than two contents:
First point: where do you want it to display (display position)
Second point: what content do you want to display (display content)
Obviously, these two points are controlled by the microcontroller. What the microcontroller tells it to display, it will display, and where the microcontroller tells it to display, it will display. This sentence can also be said in another way, such as the microcontroller "tells" the LCD1602 module: Please display the character 'A' at the 4th position of the 1st line. The so-called "telling" is that the microcontroller and the LCD1602 module are "communicating". Compare it with our usual "communication", such as making a phone call, do you start talking about the topic right away. Of course not. You need to send a signal first, such as "Hello", to say hello, and make sure that the other party can receive the signal before you start talking about the topic. Of course, some people will ask about each other's well-being before starting the conversation.
In short, there must be a "greeting" process before "communication". The same is true for the "communication" between the microcontroller and LCD1602. You also need to "say hello" first, but we have changed the term "initialization" here.
In this way, the whole idea comes out:
Step 1: Initialization (the microcontroller says hello to 1602 first)
Step 2: Determine the display position (the microcontroller tells 1602 where to display)
Step 3: Determine the display content (the microcontroller tells 1602 what to display)
3. The idea of operation steps
comes out, and the following is to implement it according to this idea. How to implement it, of course, depends on the manual given by the manufacturer of the LCD1602 liquid crystal module you are using.
3.1 Initialization
How to initialize? The 1602 manual has already told you, you don't even need to think about it, just do it.
Delay 15ms
Write instruction 38H
Delay 5ms
Write instruction 38H
Write instruction 08H
Write instruction 01H
Write instruction 06H
Write instruction 0CH
3.2 Determine the display position
How to determine the display position? As mentioned earlier, the display position is 2 lines, each line has 16 spaces, so there are 32 spaces in total. So how does the MCU tell LCD1602 which space to display? Note that the MCU and LCD1602 are both machines. Since it is a communication between machines, of course, machine language must be used. Since it is a machine language, it is nothing more than a language composed of 0 and 1. So the question now is how to determine the display position through 0 and 1. This is relatively easy. For example, if I only use one bit, then I can only determine two positions, using 0 to indicate the first space of the first line to display, and using 1 to indicate the second space of the first line to display. As mentioned earlier, 1602 has 32 spaces, and it is obvious that one bit is definitely not enough. In the same way, if two bits are used, there are 4 combinations, that is, 4 spaces can be determined, and if three bits are used, there are 8 spaces, which is still not enough. Then continue to increase the number of bits, and five bits will be enough. For example, when the microcontroller sends the information 00000 to 1602, it means that it should be displayed in the first space of the first line, 00001 means it should be displayed in the second space of the first line, and so on. However, usually the communication between machines is based on bytes (8 bits) as the smallest unit, so we can determine the display position by the combination of 8 bits of 0 and 1. As for the specific combination method corresponding to what position, you need to check the manual provided by the manufacturer. The
manual has clearly pointed out the combination of 8 bits of 0 and 1. Its highest bit is fixed to 1, and the remaining 7 bits are determined by the above table. For example, when the remaining 7 bits are 40H, it means
it should be displayed in the first space of the second line of 1602. When the remaining 7 bits are 4FH, it means it should be displayed in the 16th space of the second line.
3.3 Display content
The remaining question is how to determine the display content. Similarly, the display of content is also completed through the combination of 8 bits of 0 and 1. The different combinations of these 8 bits correspond to different display contents, as shown in the figure below. For example,
when the MCU sends 00110000 to 1602, it means telling 1602 to display character 0, and so on.
This brings up a new problem. When the MCU sends 1000 0100 to 1602, how does it know whether this information is "position" information or "content" information? Both types of information are composed of 8 bits of 0 and 1. How to distinguish them? We define "position" information as "command" and "content" information as "data". So how does the MCU tell 1602 whether it is sending a "command" or "data"? This question can be explained in detail. The above explanation is very clear.
The steps are sorted out. The following is to implement how the MCU sends a byte (command/data) to 1602 by referring to the timing diagram.
Previous article:51 single chip microcomputer temperature control fan production digital tube display Proteus simulation program
Next article:C51 MCU uses ESP8266 to configure WIFI and send temperature data source code
Recommended ReadingLatest update time:2024-11-23 11:21
- 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
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Please teach me an op amp circuit - RMS to DC circuit
- 【Silicon Labs Development Kit Review】+ PWM Example Test
- Porter-3: Will this topology work?
- Problem with the abs function
- New PWM Generator SA866 and Its Application in General Frequency Converter
- Xunwei i.MX6ULL development board-Transplant OpenCv2.4.9-QT program compilation
- Please share: Tell me about the best or most beautifully designed circuit board you have ever seen
- Microwave Transmission Technology and Application of Television Signals
- Microcontroller selection
- Made a tool to use serial port IAP to realize batch online upgrade program