Lcd12864 Chinese data summary (12864 pin description and function _features parameters and driver sharing)
- Apr 11, 2018 -

                 

Lcd12864 Introduction


The 128X64 with Chinese character library is a dot matrix graphic LCD module with 4-digit/8-bit parallel, 2-wire or 3-wire serial interface, and internal Chinese GB first-level and second-level simplified Chinese fonts; The rate is 128 & TImes; 64, 8192 16*16 dot Chinese characters, and 128 16*8 dot ASCII character sets. The use of this module's flexible interface method and simple and convenient operation instructions can constitute a full Chinese human-computer interaction graphical interface. Can display 8 & TImes; 4 lines of 16 & TImes; 16 lattice characters. Graphic display can also be completed. Low voltage and low power consumption are another significant feature. The liquid crystal display scheme composed of this module is much simpler than the same type of graphic dot matrix liquid crystal display module, regardless of the hardware circuit structure or the display program, and the price of the module is also slightly lower than that of the graphic liquid crystal module of the same dot matrix. .


Lcd12864 basic characteristic parameters


2345_image_file_copy_1.jpg


(1) Low Supply Voltage (VDD: +3.0--+5.5V)


(2) Display resolution: 128 & TImes; 64 points


(3) Built-in Chinese character library, providing 8192 16×16 lattice Chinese characters (Simplified and Traditional)


(4) Built-in 128 16 × 8 dot matrix characters


(5) 2MHZ clock frequency


(6) Display mode: STN, semi-transparent, positive display


(7) Drive: 1/32 DUTY, 1/5 BIAS


(8) Direction of view: 6 points


(9) Backlight mode: Side highlight white LED, power consumption is only 1/5-1/10 of common LED


(10) Communication: Serial and Parallel


(11) Built-in DC-DC conversion circuit without external negative pressure


(12) Simplify software design without chip select signal


(13) Operating temperature: 0°C-+55°C, storage temperature: -20°C-+60°C


Lcd12864 pin diagram and function


Lcd12864 Chinese data summary (12864 pin description and function _ characteristics parameters and driver sharing)

1VSS-module power ground


2VDD-power positive terminal of the module


3V0-LCD drive voltage input


4RS(CS)H/L Parallel Instruction/Data Select Signals; Serial Chip Select Signals


5R/W(SID) H/L parallel read/write selection signal; serial data port


6E(CLK)H/L parallel enable signal; serial synchronous clock


7DB0H/L data 0


8DB1H/L data 1


9DB2H/L data 2


10DB3H/L data 3


11DB4H/L data 4


12DB5H/L data 5


13DB6H/L data 6


14DB7H/L data 7


15PSBH/L Parallel/Serial Interface Selection: H-Parallel; L-Serial


16NC empty foot


17/RETH/L reset active low


18NC empty foot


19LED_A (LED+5V) Positive Backlight


20LED_K (LED-OV) backlight and negative


Controller Interface Signal Description


1, RS, R / W with the choice of control interface determines the four modes:


Lcd12864 Chinese data summary (12864 pin description and function _features parameters and driver sharing)


2, E signal


Lcd12864 Chinese data summary (12864 pin description and function _ characteristics parameters and driver sharing)


● Busy flag: The BFBF flag provides internal operating conditions. BF=1 indicates that the module is performing internal operations. At this time, the module does not accept external instructions and data. When BF=0, the module is ready to accept external instructions and data at any time. With the STATUSRD instruction, BF can be read to the DB7 bus to verify the module's operating status.


● Font generation ROM (CGROM) Font generation ROM (CGROM) provides 8192 This trigger is used to control the on-screen display of the module. DFF=1 is DISPLAY ON, DDRAM content is displayed on the screen, DFF=0 is DISPLAY OFF. The status of the DFF is controlled by the commands DISPLAYON/OFF and RST signals.


● Display data RAM (DDRAM) module internal display data RAM provides 64 x 2 bytes of space, up to 4 lines of 16 words (64 words) in the Chinese font display, when written to the display data RAM, Display the fonts of CGROM and CGRAM respectively; this module can display three types of fonts, which are half-width alphanumeric (16*8), CGRAM font, and Chinese font of CGROM. The choice of three fonts is based on the DDRAM. In the encoding option written in Chinese, the custom font of CGRAM will be selected in the encoding of 0000H-0006H (the codes thereof are respectively 0000, 0002, 0004, and 0006), and the half-width alphanumeric characters will be selected in 02H-7FH encoding. The font, as for the code above A1 will be automatically combined with the next byte, and the encoding of the two bytes forms the Chinese character code BIG5 (A140-D75F), GB (A1A0-F7FFH).


● Font generation RAM (CGRAM) font generation RAM provides image definition (word building) function, which can provide four groups of 16×16 points of custom image space. Users can provide image characters not provided by internal fonts. Type is self-defined to CGRAM and can be displayed on the screen through DDRAM as defined in CGROM.


● The address counter AC address counter is used to store the address of one of the DDRAM/CGRAM. It can be changed by the setting instruction register. Afterwards, as long as the value of DDRAM/CGRAM is read or written, the value of the address counter will be Add one automatically. When RS is "0" and R/W is "1", the value of the address counter is read into DB6 - DB0.


Cursor/flicker control circuit


This module provides a hardware cursor and flicker control circuit that specifies the cursor or blink position in the DDRAM by the value of the address counter.


Lcd12864 instructions


Lcd12864 Chinese data summary (12864 pin description and function _ characteristics parameters and driver sharing)

Lcd12864 Chinese data summary (12864 pin description and function _features parameters and driver sharing)

Note: Before IC1 accepts the instruction, the microprocessor must first confirm that the internal is in an off-busy condition. When reading the BF flag, BF must be zero to accept new instructions; if it is not checked before sending an instruction The BF flag must then be extended for a longer period of time between the previous instruction and the instruction, that is, waiting for the previous instruction to be executed.


Lcd12864 application example


1. Preparation before use: Apply the working voltage to the module first, and then adjust the contrast of the LCD according to the connection method in the figure below so that it shows a black bottom image. This process can also initially detect whether the LCD segment is missing.


2. Character display: 128X64-0402B with Chinese character library can display 4 rows and 8 columns of 32 characters with 16 16 dot matrix per screen. Each display RAM can display 1 Chinese character or 2 16×8 lattice full heights. ASCII characters, which can display up to 32 Chinese characters or 64 ASCII characters per screen. The 128X64-0402B with Chinese font library internally provides a 128 x 2 byte character display RAM buffer (DDRAM). The character display is achieved by writing character display codes into the character display RAM. Depending on the contents of the writing, the contents of CGROM (Chinese font library), HCGROM (ASCII font font), and CGRAM (custom font) can be displayed on the LCD screen. Three different characters / font selection code range: 0000 ~ 0006H (the code is 0000,0002,0004,0006 a total of 4) display custom font, 02H ~ 7FH display half-width ASCII code character, A1A0H ~ F7FFH shows 8192 GB2312 font fonts. The character shows the address 80H to 9FH of the RAM in the liquid crystal module. The address of the RAM displayed by the character has a one-to-one correspondence with the 32-character display area. The correspondences are shown in the following table.


Lcd12864 Chinese data summary (12864 pin description and function _ characteristics parameters and driver sharing)


3, graphic display


First set the vertical address and then set the horizontal address (write two bytes of data to complete the vertical and horizontal coordinate addresses)


Vertical address range AC5. .AC0


Horizontal address range AC3...AC0


The address counter (AC) of the drawing RAM will only automatically increase the horizontal address (X-axis). When the horizontal address = 0FH, it will be reset to 00H but it will not automatically increment the vertical address by one. Therefore, when the address is written continuously, When multiple documents are available, the program needs to determine if the vertical address needs to be reset. GDRAM coordinate address and data arrangement order as shown below:


4, application description


When using a 128X64 display module with a Chinese font library, note the following points:


1 When you want to display Chinese characters in a certain position, you should first set the display character position, that is, set the display address first, and then write the Chinese character code.


2 The process of displaying ASCII characters is the same as the process of displaying Chinese characters. However, when displaying continuous characters, you only need to set the display address once. The module automatically adds 1 to the next character position. Otherwise, the displayed character will have an empty ASCII character position.


3 When the character code is 2 bytes, the upper byte should be written first, followed by the lower byte.


4 Before the module receives the instruction, the processor must first confirm that the module is in an unbusy state. That is, when the BF flag is read, BF must be “0” to accept the new instruction. If the BF flag is not checked before sending an instruction, it must be delayed a long time between the previous instruction and the instruction, that is, waiting for the previous instruction to determine that the execution is completed. For the instruction execution time, refer to the instructions execution time description in the instruction table. 5 "RE" is the selection control bit for the basic instruction set and extended instruction set. When "RE" is changed, the subsequent instruction set will remain in the last state unless the "RE" bit is changed again. When using the same instruction set, it is not necessary to reset the "RE" bit each time.


Lcd12864 driver


/************************************************* ***************************/


/* */


/* Copyright (c) 2012, pcwebmaster */


/* All rights reserved. */


/* */


/* Email: pcwebmaste@163.com */


/* */


/************************************************* ***************************/


/************************************************* ***************************/


/* File name: LCD12864.c */


/* Version: Version 1.0 */


/* Description: Realize the communication protocol between LCD and MCU, and perform human-computer interaction according to the commands issued by the computer */


/* Producer: pcwebmaste */


/* Function: */


/* LCD12864_init */


/* LCD12864WriteCommand */


/* LCD12864WriteByte */


/* LCD12864_init */


/* LCD12864SetXY */


/* LCD12864PrintfString */


/* history record: */


/* pcwebmaste 2008-07-10 Creat Inital version. (Version 1.0) */


/* Modular 2012-06-02 Creat Inital version. (Version 2.0) */


/************************************************* ***************************/


#include "12864.h"


#define LOW 0


#define HIGH 1


Sbit wela = P2^6;


Sbit dula = P2^7;


#define LCD12864_RS(x) {if((x))P3 |= 1 "LCD12864_RS_PIN;\


Else P3 &=~(1 "LCD12864_RS_PIN);}//register selection input


#define LCD12864_RW(x) {if((x))P3 |= 1“LCD12864_RW_PIN;\


Else P3 &=~(1 "LCD12864_RW_PIN);}//LCD read/write control


#define LCD12864_EN(x) {if((x))P3 |= 1 "LCD12864_EN_PIN;\


Else P3 &=~(1 "LCD12864_EN_PIN);}//LCD Enable Control


#define LCD12864_MD(x) {if((x))P3 |= 1 "LCD12864_MD_PIN;\



Else P3 &=~(1 "LCD