Summary:
1. Different control chips may have different LCD interface definitions or register definitions.
2. There are two display modes: parallel and serial. It is said that the serial mode cannot read the data register (DR). Then can the instruction register IR be read?
3. When displaying characters with a font chip, it is not necessary to take the modulus of the characters, but the font may be short of weight, that is, some characters (even commonly used characters) are not in the font. If you encounter the situation that the character is not in the font when you test the code for the first time, it is recommended to buy sports lottery tickets to support sports!
4. The structural address of the chip must be clearly understood. I have read some information on the Internet and found that most of them are inaccurate and even contradictory.
The contents of many data manuals are even more ambiguous and unclear. There are also contradictions between data manuals!
Based on my own experimental results and combined with some information, I have come to the following conclusions:
ST7920 can control a two-dimensional drawing buffer space of 256×64 dot matrix.
For our 12864 LCD, the GDRAM size is 256*64, It is not that only half of it is used as commonly said on the Internet, but all of it is used.
It includes the visible area and the scrolling visible area. The scrolling visible area is not displayed by default and can only be seen after scrolling.
The visible area corresponds to the upper half of the dot matrix area of GDRAM 256*32, and the scrolling visible area is the lower half of GDRAM 256*32.
Then the GDRAM in the horizontal (128-255) and vertical (0-31) areas of the visible area is mapped to the lower half of the LCD screen.
This is our 12864. I will draw a picture for you to see clearly!
Some more to add:
1. Some online materials give the drawing steps and say that the first step is to set the extended instruction set 0x34. In fact, this depends on the actual situation.
For example, if you want to play a video or animation, it is very smooth to draw with it turned on
. 2. The dot method is too slow to draw. It is not recommended to use the dot method for full-screen drawing
. 3. Some methods of highlighting. The dot
method is OK for highlighting the rectangular area. It is recommended to make the rectangular range smaller, otherwise it will be slow.
The dot method has a good effect on highlighting text because the rectangular area of the text is relatively small, the speed is very fast, and it does not flicker!
However, the drawing method is more efficient in highlighting text. If there is sufficient flash space, it is recommended to use the drawing method.
I saw some codes on the Internet. When marking a dot, the 16-bit data of the current address is usually read out first, combined with the dot, and then divided into 2 bytes and written into GDRAM.
In fact, we can improve the efficiency. We only need to read one byte for reading and write one byte for writing. There is no need to read out 16 bits of data and then write them in.
4. Regarding LCD text display,
when LCD displays English and Chinese characters, it should be done in one function. It is completely unnecessary and undesirable to do it in two functions
because one function can directly output full-width and half-width characters, and can output Chinese, English and punctuation marks together.
5. Regarding drawing clearing, the code on the Internet generally clears 256*32, and the lower half of the screen is not cleared. This is OK,
but if you want to scroll the screen, you have to clear it. If you don't clear it, the data is random, and points randomly appear and pop up.
6. I saw a post that used an algorithm to realize scrolling.
In fact, as long as you understand the address structure and rewrite the setScrollPos method, that is, change a few addresses in the setPos method, you can realize circular scrolling.
If you want flexible scrolling, you can expand the 4 row coordinates in the setPos method to 8 row coordinates, because there should be 8 row coordinates.
The visible area has 4 lines, and the scrollable visible area has 4 lines, and they are continuous.
The above are some of my personal experimental conclusions! I also drew its structure diagram to facilitate the understanding of novices. Please point out any inappropriateness. Thank you!
Due to different controllers and different models of LCD codes may be different, those codes on the Internet are generally not completely universal.
As long as you understand the relationship between the address structure of the controller and the position of the LCD, you can write out the common functions. If you have any questions, just post them.
Let's communicate together.
Previous article:51 MCU study notes: merge 1602 and 12864 LCD strip interface
Next article:51 MCU learning notes: timer generates PWM adjustable square wave to control the brightness of LED lights
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- National Technology N32G032 Motor Control Board Hardware Usage Guide
- What is a Class D power amplifier?
- CBB capacitors and monolithic capacitors have better frequency characteristics, small dielectric loss, wide response range, high insulation impedance, and no polarity.
- Recommend a mall for purchasing electronic components: free shipping for new customers’ first order, and also provide services such as sample application and technical support!
- Membrane switch components
- Zhengzhou Customs destroyed 20,000 counterfeit Texas Instruments integrated circuits. Have you ever come into contact with counterfeit and shoddy products at work?
- PWM input capture, problem of selecting trigger source
- 4.2V to 50V
- Introduction to RF Gain Blocks for Radio Range and Reliability
- How to choose pliers, terminals, wires, and heat shrink tubing for DuPont cables?