1 Introduction
Commonly used liquid crystal display modules are divided into digital display liquid crystal modules, dot matrix character liquid crystal modules and dot matrix graphic liquid crystal modules. Graphic liquid crystal modules are widely used in China, because Chinese characters cannot be displayed with character modules like Western characters. Graphic modules must be used to display Chinese characters.
The Chinese character display method of graphic liquid crystal modules is studied. Based on the 8051 single-chip microcomputer, the typical interface circuit between the liquid crystal module and the single-chip microcomputer is introduced. The storage of Chinese character font data through the external EEPROM is described, and it is addressed as an external data memory. The usage method is introduced in detail through the C51 program. For single-chip microcomputers with separate addressing of program memory and data memory, this method can save program memory and expand program capacity.
2 Methods of LCD module displaying Chinese characters
Graphic LCD modules can be used to display Chinese characters and graphics. Take the DG12864 (128×64) LCD module as an example. Its built-in LCD display driver controller is T6963C from Toshiba Corporation of Japan. On the LCD screen, 8 dots horizontally represent 1 byte of data. Each byte has a corresponding address in the display buffer. The 8 dots horizontally in the upper left corner of the LCD screen correspond to the first address of the LCD module display buffer. Using the graphic display mode, Chinese characters are displayed in dot matrix on the LCD display. The most commonly used are 16×16 Chinese characters. A 16×16 Chinese character is represented by 32 bytes. The storage method of these 32 bytes is as follows:
A 24 × 24 Chinese character requires 72 bytes and is stored as follows:
The storage methods of other specifications of Chinese characters are similar. When Chinese characters need to be displayed on the LCD, the dot matrix of the Chinese characters to be displayed is written into the display buffer of the LCD controller in sequence according to the storage method.
By inputting the extracted Chinese character fonts into the LCD controller through the single-chip microcomputer, the Chinese characters can be displayed on the LCD module screen according to the settings. The common practice is to extract the fonts of the Chinese characters to be displayed through the font extraction software in advance, and store them as constant arrays in the program storage area of the single-chip microcomputer. Create a Chinese character font constant array containing the two characters "合" and "肥" in C language format, as follows:
Code const char Hz-Dot [ ] = {0x01, 0x01, 0x02, 0x04, 0x08, 0x 10, 0x 2F,0xC0, // combined with 0
0x00, 0x1F, 0x 10, 0x10, 0x10, 0x 10, 0x1F, 0x10,0x00, 0x00, 0x 80, 0x40, 0x 20, 0x10, 0xEE, 0x 04,0x10, 0xF8, 0x 10, 0x10, 0x10, 0x10, 0xF0, 0x10,0x04, 0x 7F, 0x 45, 0x45, 0x45, 0x7D, 0x 45,0x45, // 0x 20
0x45, 0x7D, 0x 45, 0x45, 0x 45, 0x45, 0x 54, 0x 88,0x04, 0xFE, 0x 24, 0x24, 0x 24, 0x24, 0x 24, 0xFC,0x04, 0x 00, 0x 00, 0x0 2, 0x02 , 0x02, 0xFE,0x00};
Each Chinese character font is composed of 32 bytes. The single-chip microcomputer uses the interface circuit and, according to the specified timing, writes all the bytes of the Chinese character font to be displayed into the LCD controller display buffer in the manner specified by the LCD controller and at the predetermined position. This method is suitable for situations where the program is not large or the single-chip microcomputer has no external expansion data storage area function.
For single-chip computers with Harvard structure, such as 8051 single-chip computers and their derivatives, the program memory (ROM) and data memory (RAM) can be addressed separately. The maximum addressing space of ROM and RAM of 8051 single-chip computers is 64K. Generally speaking, for medium-sized embedded systems, especially single-chip computer systems with LCD modules, 64K program space is not abundant, and using Chinese character fonts as constant arrays will greatly occupy ROM space. Relatively speaking, only a few K of data memory is enough, and a lot of space is left for the expansion of functional chips. The extracted Chinese character font data is stored in EPROM or EEPROM as an extended data memory for CPU to call. Then, as long as the chip select address of the chip is set and the storage location of each Chinese character font data in the chip is known, the offset address can be calculated through the program to achieve the same display function.
3. How to use the MCU to call Chinese fonts through EEPROM
Figure 1 is the interface circuit between DG12864 LCD module and 8051 MCU. In the circuit, address lines A13?A15 are decoded by GAL16V8 to obtain the chip select signal of the external expansion chip, where the decoding address of the LCD module is 0xE000, and the address line A0 is connected to the C/D of the LCD module control port. When A0 is low, the LCD controller receives data, and when A0 is high, the LCD controller receives the command code. Therefore, the data port address of the LCD module is 0xE000, and the command port of the LCD module is 0xE001. Keil C51 is used for program design, and the following definitions can be made in the program:
# define XBYTE ( ( unsigned char volatile x data* ) 0)
#definite LCD-Data XBYT E[0xE000]//LCD module data port
# def ine Lcd-Code XBYT E[ 0xE001] // LCD module command port
The chip select address of the EEPROM chip 2864 storing Chinese font data is 0x 9000, so it is defined by the program:
# def ine Hz-Dot 0x 9000
#define VBYTE (unsigned char volatile x data*)
Figure 1 51 MCU and LCD module interface circuit compilation 16 × 16 Chinese character display sub-function Wr ite-Hz. It needs to call two other sub-functions Lcd-Wait and Disp-address. Lcd-Wait is a function to read whether the LCD controller is busy, and Disp-address is a function to set the address of the LCD controller display buffer. It can be compiled according to the LCD controller data. According to the operation method of the LCD controller T 6963, each time the LCD controller is read and written, the Lcd-Wait function should be executed to determine whether the LCD controller is busy. Before writing the Chinese character font data into the LCD controller display buffer, the LCD controller display buffer address to write the data should be set according to the display position of the Chinese characters on the LCD screen. The specific Write-Hz is as follows:
void Write-Hz( Uchar x ,U char y, Uint p) // Write Chinese characters
// x, y are the coordinates of the display position of Chinese characters on the LCD screen,
// p is the subscript of the Chinese character to be displayed in the array.
{
Uchar i, low-ad, high h??ad;
Uint addr ess, tp;
address= (Uint) x * Wide+ y; / / * *
// According to the horizontal and vertical coordinates of the Chinese characters to be displayed on the LCD screen
// Set the offset address of the LCD controller's display buffer
tp=address;
for ( i= 0; i< 16; i+ + ) // write the left half
{
low-ad= (Uchar) (tp & 0x ff);
hig h-ad= ( Uchar ) ( tp 8 ) ;
Disp-address(low-ad, high-ad);
// Set the write address
Lcd-Wait ( ) ;
Lcd-Data = * ( VBYT E( Hz-Dot+ p+ i ) ) ;
// Extract Chinese fonts from EEPROM
Lcd-Wait ( ) ;
Lcd-Code = 0xC4; // Write data command
tp= tp+ Wide;
}
address+ + ;
tp=address;
fo r( i= 0; i< 16; i+ + ) // write the right half
{
low-ad= ( U char) ( tp & 0xf f ) ;
hig h-ad= ( Uchar ) ( tp 8 ) ;
Disp-address(low??ad, high??ad);
Lcd-Wait ( ) ;
Lcd-Data = * ( VBYTE ( Hz-Dot+ p+16+ i) ) ;
Lcd-Wait ( ) ;
Lcd-Code = 0xC4;
tp= tp+ Wide;
}
}
The parameters x and y of the function Wr ite??Hz correspond to the display position of the LCD screen. The upper left corner of the screen is taken as the origin, x is the vertical coordinate, and y is the horizontal coordinate. Its address in the display buffer of the LCD controller is calculated through row* *. In this row, Wide is the pre-defined number of bytes per row of the LCD screen. For the DG12864 LCD module, Wide is 16.
The function Write-Hz changes the display address in sequence according to the storage format of 16×16 dot matrix Chinese characters in the display buffer of the LCD controller. First, the left half 1~16 bytes are written into the display buffer, and then the right half 17~32 bytes are written. Assuming that the two characters "Hefei" are stored in the front row of 2864, the offset address of the first byte of the "He" character model in 2864 is 0, a total of 32 bytes, and the first address of the "Fei!" character model following it is 0x20. If the LCD module is to display the two characters "Hefei!", just call the function with the display address parameter in the program. For example:
Write-Hz( 0, 4, 0) ; // Close
Write-Hz( 0, 10, 0x20) ; //
4 Conclusion
This paper introduces the Chinese character display method of graphic LCD, and based on the 8051 single-chip microcomputer, combined with the typical interface circuit of the LCD module and the single-chip microcomputer, describes the method of using EEPROM or EPROM to store Chinese character fonts, and gives a C51 program example, which has strong usage guidance.
Previous article:LED backlight causes excessive heat dissipation in New iPad
Next article:Analysis of the use environment and impact of LED street light power supply
- Popular Resources
- Popular amplifiers
- Linux lcd_display_font tutorial
- Research on control algorithm and program design of intelligent tracking car_Technical report of the first \"Freescale\" Cup National College Student Intelligent Car Invitational Competition
- Design of voice/text message wireless transmitter
- v4l2 acquisition and display program
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- 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
- On Double 11, are there any SSDs with SATA interface that I can buy?
- [LPC] [Help] I have a problem now. I want to use the LPC1768 MCU hardware I2C interrupt to drive the OLED
- Looking for Samsung DDR3eMMC Datasheet
- How to log in to a website account using ESP32?
- Taking the core-G1 [STM32F103C8T6] core board marquee experiment introductory series 1 project as an example, this paper introduces STM3...
- MCP2517 (SPI to CAN) debugging record
- ESP32, Micropython serial port send write() usage problem - thank you!
- Vernacular Big Data and Machine Learning
- CC1310/CC1350 with TI-RTOS operating system Sensor, Collector routine frequency hopping mode communication details
- Newbies learning 51 MCU, online help