Applets
Phone:
400-820-3783
The public

National joint insurance

The products have passed 3C, CE, FCC and other certifications

News
Liquid crystal display Chinese character pattern storage method
2022-07-06

Liquid crystal module display method of Chinese characters


   1


   Use the graphic liquid crystal module to display Chinese characters and graphics in the form of dot matrix. Every 8 points form 1 byte, and each point is represented by a binary digit. When a point stored in 1 is displayed, a bright spot is displayed on the screen; a point stored in 0 is not displayed on the screen. The most commonly used 16 The Chinese character lattice of ×16 consists of 32 bytes. Taking the LCD drive controller T6963C, which is widely used in my country, as an example, 8 horizontal dots on the LCD screen are 1 byte data, then the 16×16 dot matrix font of the word "国" is shown in Figure 1. The font extraction software extracts the font of the word "国" according to the method of first left, then right, first up and then down, and then the 32 byte values corresponding to the font on the right side of Figure 1 can be obtained. Write these bytes into the display buffer area of the LCD controller in a certain order, and the 16×16 word "country" can be displayed on the LCD screen. Similarly, a 24×24 Chinese character needs 72 bytes, and the storage method is shown in Table 1. Other specifications of Chinese characters are stored in the same way.


 


Typical interface circuit of LCD controller


   2


   Input the character pattern of the extracted Chinese characters into the liquid crystal controller through the single-chip microcomputer, and then the required Chinese characters can be displayed on the LCD module display screen according to the setting. Fig. 2 is the interface circuit of the typical liquid crystal module and the one-chip computer. In the figure, the 8051 single-chip microcomputer, which is widely used in my country, is selected as the MCU, and the 12864 (128×64) liquid crystal module is used. The built-in liquid crystal display driver controller is T6963C of Toshiba Corporation of Japan. In the circuit, the address lines A12-A15 and the WR and RD signals decode the chip select signal of the external expansion chip through GAL16V8. The decoding address of the liquid crystal is 0xE000, and the address line A0 is connected to the C/D of the liquid crystal control port. When A0 is low, the liquid crystal controller receives data, and when A0 is high, the liquid crystal controller receives the command code. So the LCD data port address is 0xE000, and the LCD command port is 0xE001. Using KeilC51 for programming, the following definitions can be made in the program:


 


    #define XBYTE ((unsigned charvolatile xdata *) 0)


    #define Lcd_Data XBYTE[0×E000] //LCD data port


    #define Lcd_Code XBYTE[0×E001] //LCD command port


   The data line of the single-chip microcomputer is connected to the data port of the liquid crystal controller through the 74HC245 bidirectional buffer. The chip select signal/LCD_CS of the liquid crystal controller is used as the enable signal of the 74HC245, and the write signal/WR of the single-chip microcomputer controls the data transmission direction. When /WR is low, the microcontroller data is written into the LCD controller; when /WR is high, the CPU reads the data and status of the LCD controller.


Chinese character font storage and extraction method


   3


   In the single-chip microcomputer system, the storage of the font model can be adopted in the following three ways according to the program storage capacity of the single-chip microcomputer and its addressing space.


 


   ① Store the extracted Chinese character data as a constant array in the program storage area. This method is more commonly used, and is aimed at the situation that the program is not large or the microcontroller does not have the function of external extended data storage area.


   As shown in the following program, the extracted font data of Chinese characters to be displayed is defined as a constant array. If you want to display the word "Hefei".


    const char Hz_Dot[]={ // Chinese character 16×16 dot matrix


 0×01, 0×01, 0×02, 0×04, 0×08, 0×10, 0×2F, 0×C0,//combined 0


 0×00, 0×1F, 0×10, 0×10, 0×10, 0×10, 0×1F, 0×10,


 0×00, 0×00, 0×80, 0×40, 0×20, 0×10, 0×EE, 0×04,


 0×10, 0×F8, 0×10, 0×10, 0×10, 0×10, 0×F0, 0×10,


 0×04, 0×7F, 0×45, 0×45, 0×45, 0×7D, 0×45, 0×45, // fertilizer 0×20


 0×45, 0×7D, 0×45, 0×45, 0×45, 0×45, 0×54, 0×88,


 0×04, 0×FE, 0×24, 0×24, 0×24, 0×24, 0×24, 0×FC,


 0×04, 0×00, 0×00, 0×02, 0×02, 0×02, 0×FE, 0×00};


   Then compile the Chinese character display sub-function Write_Hz, in which the other two sub-functions Lcd_Wait and Disp_address should be called. Lcd_Wait is a function for reading whether the LCD controller is busy, and Disp_address is a function for setting the display buffer address of the LCD controller, which can be compiled according to the data of the LCD controller.


    void Write_Hz(Uchar x,Uchary,Uint p) //Write Chinese characters


   //x, y are the coordinates of the display position of the Chinese character on the LCD screen, and p is the subscript of the Chinese character to be displayed in the // array.


    {

 Uchar i,low_ad,high_ad;


 Uint address,tp;


 


 address=(Uint)x*Wide+y; //**


 tp=address;


 for(i=0;i<16;i++) //write the left half


 {


  low_ad=(Uchar)(tp &&0xff);


  high_ad=(Uchar)(tp >>8);


  Disp_address(low_ad,high_ad);


  Lcd_Wait( );


  Lcd_Data=Hz_Dot[p+i]; //***


  Lcd_Wait( );


  Lcd_Code=0×C4;


  tp=tp+Wide;



 }


 address++;


 tp=address;


 for(i=0;i<16;i++) //write the right half


 {


  low_ad=(Uchar)(tp &&0×ff);


  high_ad=(Uchar)(tp >>8);


  Disp_address(low_ad,high_ad);


  Lcd_Wait( );


  Lcd_Data=Hz_Dot[p+16+i]; //****


  Lcd_Wait( );


  Lcd_Code=0xC4; //write data command


     tp=tp+Wide;


     }


    }


   The parameters x and y of the function Write_Hz correspond to the display position of the LCD screen, which can be calculated from the address in the display buffer of the LCD controller through the line **. In this line, Wide is the number of bytes per line of the LCD screen defined in advance. For the DG12864 LCD, the Wide is 16. The function Write_Hz changes the display address in turn according to the storage form of the 16×16 dot matrix Chinese characters in the display buffer of the LCD controller, first writes the 1~16 bytes in the left half into the display buffer, and then writes the 17 bytes in the right half ~32 bytes. To display the word "Hefei" on the LCD, just call this function with the display address parameter in the program. like:


   Write_Hz(0,4,0); //combined


   Write_Hz(0,10,0x20); //fat


   ② Store the extracted Chinese character pattern data in EPROM or EEPROM as an extended data memory for the microcontroller to call. The single-chip microcomputer using Harvard structure, such as 8051 single-chip microcomputer and its derivatives, can be addressed separately for program memory (ROM) and data memory (RAM). Generally speaking, for a medium-sized embedded system, especially a single-chip microcomputer system with liquid crystal, the 64K program space is not rich, and using the Chinese character pattern as a constant array will greatly occupy the ROM space. Relatively speaking, the data memory only needs a few K, and there is a lot of space left for the expansion of functional chips. Store the extracted Chinese character data in EPROM or EEPROM, and set the chip selection address of the chip, as long as you know the storage location of a certain Chinese character data in the chip, and calculate the offset address through the program, the display can be realized. Function. For example: Set the chip select address of the EEPROM storing the Chinese character data to 0x9000, then define it through the program:


    #defineHz_Dot 0×9000


    #define VBYTE (unsignedchar volatile xdata *)


   To program the Chinese character display sub-function Write_Hz, just add the above Write_Hz function:


    Replace the *** line with Lcd_Data=*(VBYTE(Hz_Dot+p+i));


    Replace the **** line with Lcd_Data=*(VBYTE(Hz_Dot+p+16+i)).


   ③ Put the entire Chinese character library in the EPROM or EEPROM, and the program calls the Chinese character model according to the internal code of the Chinese character to be displayed. Some high-end microcontrollers, such as MOTOROLA's M68300 series 32-bit microcontrollers, have an addressing range of up to 8M. The commonly used 16×16 Chinese character library binary data file for liquid crystal display is 200K. The Chinese character library is stored in a large-capacity EEPROM, and each Chinese character in the Chinese character library can be addressed through the address line. The identification of Chinese characters in the computer is realized by the internal code, and the standard internal code of Chinese characters is a 2-byte code. Chinese characters are arranged according to the location in the Chinese character library. There are 94 Chinese characters in each area, and each Chinese character corresponds to the area code of ** and the location number in this area. There is a location code method in the Chinese character input method. In fact, there is a standard correspondence between the internal code of Chinese characters and the area code. The area code of a Chinese character in the font library plus 0×a0 is equal to the high byte of its internal code, and the number plus 0×a0 is equal to its internal code. the low byte of the code. Therefore, it is easy to calculate the location number of the Chinese character to be displayed in the Chinese character library through the program, that is, to obtain its offset address in the Chinese character library. Since the entire Chinese character library is stored in the EEPROM, it is only necessary to set the memory chip selection address of the Chinese character library on the hardware, directly attach the Chinese character as a character array to the Chinese character display function, and calculate the area code and bit number through the internal code. It is convenient to call the Chinese character model. Compared with the first two methods, there is no need to extract the font in advance and set its address for program calling. Therefore, when the program is upgraded and the display of Chinese characters is involved, there is no need to change the font data of Chinese characters.


Conclusion


   4


   This paper introduces the Chinese character display method of graphic liquid crystal, and based on 8051 single-chip microcomputer, combined with the typical interface circuit of liquid crystal module and single-chip microcomputer, it introduces three methods of storing Chinese character fonts, and gives an example of C51 program, which has a strong use guide. sex.


暂无评论!
我要评论 只有购买过该商品的用户才能评论。
WeChat public account
LINKS:

Manager Wang: 13391240541 Customer Hotline: 400-820-3783 Landline: 021-34602052

Website: www.tvodm.com

Email: 879947132@qq.com

Address: 2nd Floor, Building 10, No. 559, Dongzhou Road, Songjiang District, Shanghai


Shanghai LCD splicing screen manufacturer Jingke Electronics is mainly engaged in:

……

WeChat applet

Welcome to consult: 400-820-3783