1 Dot-matrix LCD interface technology
The single-chip microcomputer can directly control the LCD display module in the form of memory access and I/O device access through the data bus and control signal. This article takes AT89C51 as an example, and its interface circuit with YEJHD19264 is shown in Figure 1. The single-chip microcomputer controls the CSA and CSB column selection drivers through P2.6 and P2.7. At the same time, AT89C51 uses P2.1 as the R/W signal to control the data flow of the data bus, and uses P2.0 as the D/I signal to control the selection of the register. The E signal is controlled by P2.4 of AT89C51. The LCD power control terminal VO in the circuit is used to adjust the grayscale of the display screen. Adjusting the voltage at this terminal can change the color depth of the characters and graphics on the display screen. The basic display timing circuit and display driver can be found by consulting the display product manual.
2. Display control technology of dot matrix LCD
According to the functions and characteristics of dot matrix LCD, the author studied two widely used control algorithms, left (right) circular displacement algorithm and page turning algorithm.
2.1 Left (right) circular shift algorithm
This algorithm is used in advertisements or on-board station announcement systems. As shown in Figure 2, taking the left loop as an example, if an advertisement with a string of 8 Chinese characters (16*16 font) is to be displayed on the second row of a 192*64 dot matrix LCD (4 rows and 12 columns when the 192*64 dot matrix displays 16*16 font), the specific algorithm is shown in Figure 3.
Note: Consider the 8 characters as a whole, i.e., a Chinese character string, and use the display coordinates of the first Chinese character as the display coordinates of the entire Chinese character string, and initialize it to the rightmost coordinate value (assuming that the advertisement moves from right to left). Then extend to the left to display 8 Chinese characters (an advertisement) in sequence. If during the display process, the coordinates of some Chinese characters exceed the display limit of the LCD screen, the control program will not display these Chinese characters, as shown in the dashed small box in Figure 2. When the display coordinates of the Chinese character string are shifted to the left by one position (minus 1), it is necessary to determine whether the coordinate value is equal to -7 (if it is equal to -7, then the left shift is completed, and it is reinitialized to the rightmost coordinate value to prepare for the second round of left shift; if it is not equal to -7, then the current round of left shift has not yet ended).
[page]
In practical applications, the left (right) circular shift algorithm can also be improved and expanded according to system requirements to make its application more flexible. For example, if the advertising slogan is required to be changeable in real time, that is, when the user inputs a new advertisement through the serial port or other external interface, the original old advertisement should be replaced by the new advertisement. In this way, the algorithm will be more complicated because in addition to the change of the content of the advertisement itself (word change), the number of words may also change.
2.2 Page Turning Algorithm
This algorithm is used in the short message display system. First, the number of pages required for display must be calculated. The formula is:
Among them: P is the page number, S is the total number of Chinese characters to be displayed, and M is the maximum number of Chinese characters that can be accommodated on the entire screen.
For example, when displaying 100 Chinese characters, 100/46 (the original divisor should be 48, but two Chinese characters should be reserved as the display position of the prompt for turning pages up and down), the quotient is 2 and the remainder is 8. This means that the 100 characters are displayed on 3 pages, with 46 Chinese characters displayed on the first and second pages, and the last 8 Chinese characters displayed on the third page. Secondly, it is also necessary to establish a corresponding relationship between the page number and the first address of the memory of a screen of Chinese characters, that is, for 100 Chinese characters, the first address of the first 46 Chinese characters corresponds to the first page, the first address of the next 46 Chinese characters corresponds to the second page, and the remaining 8 Chinese characters correspond to the third page. Because one address stores one byte, and the Chinese character internal code consists of two bytes, then the calculation formula for the storage first address of any screen of Chinese characters is:
Among them: t is the first address of any Chinese character storage on the screen, T is the first address of all Chinese characters storage, M is the maximum number of Chinese characters that can be accommodated on the entire screen, and P is the number of pages. The following algorithm structure still takes the 192*64 dot matrix display as an example, and the entire display part program structure diagram is shown in Figure 4.
Description: According to the different pages to be displayed, the text divides the page display into three software modules, namely: the homepage display module, which represents the Chinese characters of the first page; the middle page display module, which represents all other pages other than the first page and the last page; and the last page display module, which represents the Chinese characters of the last page. At the beginning of the program, the variable P is used as the page identifier to be displayed, and the initial value is 1. Therefore, when the program enters the loop for the first time, it enters the homepage module. At this time, the first address of the Chinese characters storage on this screen is calculated according to formula (2), so as to display the first page content and display the page down prompt at the same time. Then wait for the external key interruption. When the page down key prompt comes, the P value is changed (increased by 1) and enters the middle page display module or the last page display module. When the program enters the middle page display module, the first address of the Chinese characters storage on this screen is calculated according to formula (2), the Chinese characters on this screen are displayed, and the page up and page down prompts are displayed at the same time. Then wait for the external key interruption. When the page down or page up key prompt comes, the P value is changed (increased by 1 or subtracted by 1) and enters the previous page display module or the next page display module. Note: The previous page display module here may still be the middle page, not the first page; similarly, the next page display module may still be the middle page, not the last page, depending on the total number of pages. When the program enters the last page display module, the first address of the Chinese characters on this screen is calculated according to formula (2), and the Chinese characters on this screen are displayed, and the page-up prompt is displayed at the same time. Then wait for an external key interrupt. When the page-up key prompt comes, change the P value (minus 1) to enter the middle page display module or the first page display module.
[page]
In practical applications, the page-turning display algorithm can be combined with the short message storage and access algorithm and the file system to realize a display system similar to the short message mode of a mobile phone.
3 Experimental Design and Results
3.1 Design Idea
When designing the peripheral hardware, the author used E2PROM to store the Chinese character library, and 8 kB of external RAM to store the internal code of each Chinese character in the short message and advertisement, and then converted the internal code into the first address of the Chinese character library font, and then read the font in E2PROM. In the external RAM, the area is divided: the first 4 kB: store the short message that has been preprocessed and is about to be displayed, which can accommodate 2000 Chinese characters (2 B for each Chinese character). The next 2 kB: store the advertisement that has been preprocessed and is about to be displayed. Due to the addition of a scrolling mechanism, it can only accommodate 200 Chinese characters. The last 2 kB: store the BTYE received by the serial port, including all the preprocessing of unpacking and decoding. Here, as mentioned earlier, the useful information is extracted, and the extracted Chinese character part is sent to the short message or advertisement storage area to wait for the display command. This area can support a coding length of 2 000 B. At the same time, 4 buttons are designed to control the up and down page turning, the switch between the advertisement mode and the message mode, and the reset of the microcontroller.
3.2 Experimental Results
Figure 5 is the result of the experiment. Since the advertisement is scrolling, a static image cannot be used to describe it clearly, so here we only show the short message display image. This is the middle page display, with the upper left corner and lower right corner being the prompts for turning up and down, respectively. The author lets the microcontroller sequentially extract Chinese characters from the character library for display.
4 Conclusion
These two algorithms have been applied to vehicle-borne and ship-borne short message communication systems based on wireless measurement and control networks. At the same time, the algorithms can be further expanded to meet more complex system requirements. I hope this article can provide a way of thinking and method to solve practical problems for those program developers based on low-end LCD applications.
Previous article:Application of LED display driver chip
Next article:Design of LED backlight drive scheme for medium-sized display screen
Recommended ReadingLatest update time:2024-11-16 22:49
- Popular Resources
- Popular amplifiers
- Mission-oriented wireless communications for cooperative sensing in intelligent unmanned systems
- Monocular semantic map localization for autonomous vehicles
- ICCV2023 Paper Summary: Efficient and Scalable Vision
- Algorithm Notebooks Practical Guide for Computer Training (Edited by Hu Fan and Zeng Lei)
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Enjoy big-screen gaming anytime, anywhere: Making portable 4K UHD 240Hz gaming projector a reality
- AMD surpasses Intel: CPU shipments surge in Q3 this year
- Exynos is losing ground, Samsung plans to use Qualcomm chips in home appliances
- Intel and 50 partners unveiled a full range of 30 notebook and desktop AI PCs equipped with Intel Core Ultra (2nd Generation)
- Innovation leads the new trend of mobile refrigeration GMCC will present new products at 2024 CIAAR
- Lenovo and NVIDIA expand collaboration to jointly launch new liquid-cooled AI servers
- Ceiling fan solution based on XMC1302
- Gartner: Global AI PC shipments are expected to account for 43% of total PC shipments in 2025
- 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
- [Qinheng Trial] Experience of CH549 capacitive touch function
- Raspberry Pi PICO low-resolution thermal imager
- Why does the power consumption of stm32L0 increase after it enters STOP mode again after being woken up by an external interrupt in STOP mode?
- [TI millimeter wave radar evaluation]_4_boost board evaluation encountered problems 2
- Using registers to do STM8 UART1 error request help
- BearPi-HM Nano Development Board Review 0 Unboxing and Development Environment Setup
- Let's discuss how many people you think should be invited.
- Qinheng CH37X series interface chip application reference example
- I found another DK IOT STUDIO online IDE that runs RAPID IOT. I guess they are the same but distributed on different websites.
- ECG-based heart rate monitoring using the LaunchPad Value Line development kit for the MSP430G2452 microcontroller