Fundamentals of 1 system 12,864 point formation liquid crystal display
12,864-point array graphic liquid crystal display application, one through C51 programming realizes to the LCD12864 LCD screen control, the liquid crystal display (LCD) has the low operating voltage, the micro power consumption, the display is flexible, the low cost characteristic.
The data in the digital circuit is saved in 0 and 1, and different data are operated on the LCD controller, and different results can be obtained. For English operation, only 8 bits (one byte) are required due to the small number of English letters. And for the Chinese, but there are more than 6000, so our DOS predecessors think of a way, is the high 128 of the ASCII table is rarely used to the value of two as a group to represent Chinese characters, that is, the inner code of Chinese characters. The remaining 128 digits are reserved for English characters, which is the inner code of the English language.
After the inner code of the Chinese characters is obtained, the shape of the English or Chinese characters is recorded by using the characters of the text, that is, the English language ' A ' is shown in 1 of the type of the word:
And the Chinese "you" in the font of the record is 2:
2. Chinese character graphic dot matrix LCD module (QC12864B) main technical parameters and display characteristics:
① qc12864b Chinese character graphic dot matrix LCD display module, can display Chinese characters and graphics
② built-in 8192 16x16 dot matrix), 128 characters ( 8x16 dot matrix) and 64x256 dot matrix display RAM ( gdram )
③ power supply: VDD 3.3v~+5v ( built-in boost circuit, no negative pressure required ) ; Display content: - column x - Line
④ Display color: yellow green screen, blue
⑤ Display angle: 6 : xx The clock looks straight
⑥ LCD Type: STN
⑦ with the MCU Interface: 8 bit parallel port or serial Configuration LED Backlight
⑧ multiple software functions: Cursor display, screen shift, custom characters, sleep mode, etc.
3.qc12864b Read and write operation timing:
The modules have parallel and serial two connection methods (timing is as follows):
One, 8-bit parallel connection timing diagram
The MPU writes the data to Module 4:
Figure 4 MPU write data to module diagram
①mpu from the module read the data 5:
Figure 5 MPU reading a data map from a module
Second, serial connection sequence diagram
Serial data transfer is done in three bytes:
First byte: Serial Control-format 11111ABC
①a for data transfer Direction control: H represents data from LCD to mcu,l for data from MCU to LCD
②b for data type: H indicates data is display data, L indicates data is control instruction
③c fixed to 0
Second byte: (parallel) 8-bit data high 4-bit-format DDDD0000
Third byte: (parallel) 8-bit data low 4-bit-format 0000DDDD serial Interface timing parameters: (Test conditions: t=25℃vdd=5.0v)
4.qc12864b dot-Matrix LCD pin Function Description:
Table 1 pin description for 12864LCD
PIN number |
Pin Name |
LEVER |
Pin function Description |
1 |
Vss |
0 |
Power supply Ground |
2 |
Vdd |
+5.0v |
Power supply voltage |
3 |
V0 |
- |
LCD Display Drive Voltage |
4 |
d/i (RS) |
h/l |
D/i= "H", representing Db7∽db0 as the display data D/i= "L", indicating db7∽db0 for display instruction data |
5 |
r/w |
h/l |
R/w= "H", e= "H" data is read to Db7∽db0 R/w= "L", e= "H→l" data is written to IR or Dr |
6 |
E |
h/l |
R/w= "L", e-signal falling along latch db7∽db0 R/w= "H", e= "H" ddram data read to Db7∽db0 |
7 |
Db0-db7 |
h/l |
Data cable |
8 |
CS1 |
h/l |
H: Select the chip (left half screen) signal |
9 |
CS2 |
h/l |
H: Select the chip (right half screen) signal |
10 |
Ret |
h/l |
Reset signal, low power level |
11 |
VOUT |
-10v |
LCD Drive Negative Voltage |
12 |
Led+ |
- |
LED Backlight power supply |
13 |
led- |
- |
LED Backlight power supply |
Description: 12,864-point formation liquid crystal C language Program (can be set according to their own preference points)
/********************** Electronic System Design C51 programming ************************* Platform: bst-v51 + Keil U4 + stc89s52* Name: This program driver 12864 display a picture (including English characters, Chinese characters, graphics) * date: Long time ago * Crystal: 11.0592mhz* Description: Electronic games * written: sure***************** /#include <reg51.h> #include <intrins.h> #define Uchar unsigned char#define uint unsigned int/*12864 port definition */#define LCD_DATA P0 //Data port sbit lcd_rs = p1^0 ; Register selection input Sbit lcd_rw = p1^1; LCD read/write control sbit lcd_en = p2^5; Liquid crystal Enable control sbit LCD_PSB = p1^2; Serial/and control unsigned char code zhu[]=//picture Codes
{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x3e,0x03,0xe0,0xff,0xff,0xff,0x00,0xfe,0x00 , 0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0xff,0x8f,0xf8, 0xff,0xff,0xff,0x00,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0xff , 0X81,0XFF,0XDF,0XFC, 0xff,0xff,0xff,0x3c,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0xfc,0x03,0xff,0xff,0xfe, 0xFF,0xF9 , 0xff,0x18,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0xe0,0x03,0xff,0xff,0xfe, 0xff,0xfc,0xff,0x18,0xfe,0x3c,0x74,0x0f , 0xff,0xff,0xff,0x00,0x07,0x9c,0x70,0x0f, 0xff,0xfe,0x7f,0x18,0xfe,0x02,0x2a,0x0f,0xff,0xff,0xf8,0x00,0x07,0xbe , 0x71,0x8f, 0XC0,0X3F,0X3F,0X18,0XFE,0X3E,0X2A,0X0F,0XFF,0XFF,0XC0,0X00,0X07,0XF7,0X73,0XCF, 0xFF,0xFE,0x7F,0x18 , 0xfe,0x42,0x2a,0x0f,0xff,0xfe,0x00,0x00,0x07,0xe3,0x76,0x6f, 0XFF,0XC1,0XFF,0X3C,0XFE,0X42,0X2A,0X0F,0XFF,0XFC , 0x00,0x00,0x07,0xf7,0x06,0x6f,0xff,0xbe,0xff,0x00,0xfe,0x3d,0x6b,0x0f,0xff,0xe0,0x00,0x00,0x03,0xbe,0x73,0xce , 0xff,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x01,0xf3,0x9c,0xf9,0x8e,0xfF,0XBF,0X99,0X89,0XC1,0XFF,0XFE,0X00,0X0F,0XE0,0X00,0X03,0XFF,0X81,0XFC,0X0E, 0xF1,0xC1,0xD1,0xE6,0xBE,0xFE, 0X00,0X00,0X0B,0XC0,0X04,0X7F,0XFD,0XF9,0XFC,0XFC, 0xff,0xfe,0xdd,0xef,0x80,0xfc,0x00,0x03,0x63,0x00,0x03,0xff, 0xfc,0xfd,0xfd,0xf8, 0xff,0xfe,0xdd,0xef,0xbf,0xe0,0x00,0x00,0xf3,0x00,0x03,0xff,0xfc,0x7c,0xf9,0xf8, 0xFF,0xBE, 0XD9,0XEF,0XBE,0XE0,0X00,0X00,0XF3,0X00,0X1F,0XFF,0XFC,0X7C,0X71,0XF0, 0XFF,0XC1,0XE4,0X83,0XC1,0X80,0X00,0X01, 0X7F,0X00,0X3F,0XFF,0XFC,0X1D,0X05,0XE0, 0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x03,0x7e,0x00,0xff,0xff,0xfc,0x0d, 0xfd,0x80, 0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x03,0x7e,0x00,0x7f,0xff,0xe4,0x07,0xff,0x00, 0xFF,0xFF,0x7F,0xF0, 0x00,0x00,0x00,0x07,0xf8,0x00,0xff,0xff,0xe5,0xf9,0xfc,0x00, 0xff,0xe3,0xaf,0xc0,0x00,0x00,0x07,0xbf,0xf8,0x00, 0xff,0xff,0xe7,0xfe,0x70,0x00,0xff,0xe3,0x9f,0x80,0x00,0x00,0x0e,0x1f,0xf0,0x01,0xff,0xff,0xcf,0xff,0x00,0x00, 0xff,0xc3,0x8f,0x80,0x00,0x00,0x3e,0x4f,0xf0,0x00,0xff,0xfc,0x0f,0xff,0x00,0x00, 0xFF,0xc3,0x8f,0x00,0x00,0x10,0xfe,0x0f,0xe0,0x01,0xff,0xe0,0x0f,0xff,0x00,0x00, 0xFF,0x03,0x13,0x80,0x00,0x03, 0xfc,0x8f,0xe0,0x01,0xff,0xff,0xc7,0xfe,0x00,0x00,0xff,0x04,0x12,0x80,0x00,0x00,0x7c,0x0f,0x80,0x03,0xff,0xff, 0xc5,0xf8,0x00,0x00, 0xfe,0x0c,0x17,0xc0,0x00,0x00,0x00,0x3e,0x00,0x07,0xff,0xff,0xc0,0xf0,0x0e,0x00, 0xFE,0x1E, 0x67,0x7e,0x30,0x00,0x00,0x08,0x00,0x07,0xff,0xff,0xc0,0xf8,0x1f,0x00, 0xfc,0x1c,0x42,0x7f,0x00,0x06,0x00,0x00, 0x40,0x0f,0xff,0xff,0xc1,0xf8,0x3f,0x80, 0xfe,0x08,0x48,0x7f,0x40,0x01,0x78,0x10,0xc0,0x0f,0xff,0xff,0xc1,0xf8, 0X7F,0XC0, 0xfe,0x08,0x08,0x7f,0x40,0x01,0x78,0x10,0xc0,0x0f,0xff,0xff,0xc1,0xf8,0xff,0xe0, 0xFE,0x00,0x00,0x7E, 0x60,0x00,0x00,0x10,0x80,0x3d,0xbf,0xff,0xc1,0xf9,0xff,0xf0,0xff,0x00,0x00,0x1c,0xc0,0x00,0x04,0x00,0x00,0x39, 0X3F,0XFF,0XC1,0XF9,0XFB,0XF0, 0XFF,0X00,0X00,0X71,0X00,0X00,0X3C,0X00,0X00,0X39,0X3F,0XFA,0X41,0XF9,0XFF,0XF0, 0XFF,0X80,0X00,0X60,0X30,0X01,0XC0,0X00,0X00,0X01,0X1B,0X02,0X41,0XF8,0XFF,0XE0, 0xFF,0xC8,0x00,0x00,0x31,0X1F,0X00,0X00,0X40,0X00,0X00,0X02,0X41,0XF8,0X7F,0XC0, 0xff,0xc4,0xfe,0x00,0x03,0x00,0x07,0xc7,0xc2,0x00,0x00, 0x04,0x01,0xf8,0x3f,0x80, 0xff,0xff,0xf0,0x00,0x0f,0xe0,0x3f,0x9c,0x0f,0x80,0x00,0x04,0x01,0xf8,0x1f,0x00, 0xFF, 0XFF,0XF8,0X10,0X0F,0XC0,0X7E,0X3F,0XE7,0XFF,0X00,0X00,0X01,0XF8,0X0E,0X00,0XFF,0XFF,0XF8,0X1E,0X0F,0XE0,0X70, 0x3f,0xe0,0x3f,0x00,0x00,0x01,0xf8,0x00,0x00, 0XFF,0XFF,0XFC,0X1E,0X1D,0XE0,0X77,0X00,0XE0,0X00,0X00,0X00,0X01, 0xf8,0x00,0x00, 0xff,0xff,0xfc,0x03,0x99,0xe0,0xe7,0x36,0xe0,0x00,0x00,0x00,0x03,0xfc,0x00,0x00, 0xFF,0xFF,0xFC, 0x00,0x3f,0xf0,0xc3,0x36,0xf0,0x00,0x00,0x1c,0x73,0xfc,0x00,0x00, 0XFF,0XFF,0XFC,0X18,0X7B,0X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FF, 0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X04,0X70,0X3F,0XFF,0XD7,0XFE,0XFF,0XE0, 0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00, 0x01,0xf0,0x3f,0xff,0xd7,0xfe,0xff,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x40,0x1f,0xf0,0x00,0x3f,0xe7,0xfe,0x00,0x00, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf1,0x00,0x00,0xe7,0xfe,0x00,0x00, 0xFF,0xFF,0xFF, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x07,0xfe,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0XFF,0XFF,0XC0,0X07,0XFE,0X00,0X00};
#define DELAYNOP (); {_nop_ (); _nop_ (); _nop_ (); _nop_ ();}; void Delay0 (Uchar x); X*0.14msvoid dataconv (); void Lcd_pos (Uchar X,uchar Y); Determines the display position of void delay (int ms) {while (ms--) {Uchar I; for (i=0;i<250;i++) {_nop_ (); _nop_ (); _nop_ (); _nop_ (); } }}/*******************************************************************//* *//* Check the LCD busy status *//*lcd_busy is 1 o'clock, busy, waiting. Lcd-busy is 0 o'clock, idle, can write instruction and data. *//* *//************************************************** /bit Lcd_busy () {bit result; lcd_rs = 0; LCD_RW = 1; Lcd_en = 1; Delaynop (); result = (bit) (p0&0x80); lcd_en = 0; return (result); }/*******************************************************************//* write command data to LCD *//*rs=l,rw=l,e= high pulse, d0-d7= instruction code. *//*******************************************************************/void lcd_wcmd (uchar cmd) { while (Lcd_busy ()); lcd_rs = 0; LCD_RW = 0; lcd_en = 0; _nop_ (); _nop_ (); P0 = cmd; Delaynop (); Lcd_en = 1; Delaynop (); lcd_en = 0; }/*******************************************************************//* *//* writes display data to the LCD *//*rs=h,rw=l,e= high pulse, d0-d7= data. *//* *//*************************************** /void lcd_wdat (Uchar dat) {while (Lcd_busy ()); Lcd_rs = 1; LCD_RW = 0; lcd_en = 0; P0 = dat; Delaynop (); Lcd_en = 1; Delaynop (); lcd_en = 0; }/*******************************************************************//* *//* LCD Initialization Settings *//* *//*******************************************************************/void Lcd_init () { LCD_PSB = 1; Lcd_wcmd mode (0x34); Extended instruction Operation delay (5); Lcd_wcmd (0x30); Basic instruction Operation delay (5); Lcd_wcmd (0x0C); Display on, off cursor delay (5); Lcd_wcmd (0x01); Clear the LCD display content delay (5);} /******************************************* function Name: draw_pm function: Drawing parameters on the entire LCD screen: No return value: No ******************************** /void draw_pm (const Uchar *ptr) {Uchar i,j,k;lcd_wcmd (0x34); Open extension instruction Set i = 0x80; for (j = 0;j < 32;j++) {lcd_wcmd (i++); Lcd_wcmd (0x80); for (k = 0;k < 16;k++) {Lcd_wdat (*ptr++);}} i = 0x80; for (j = 0;j < 32;j++) {lcd_wcmd (i++); Lcd_wcmd (0x88); for (k = 0;k < 16;k++) {Lcd_wdat (*ptr++);}} Lcd_wcmd (0x36); Open the drawing display Lcd_wcmd (0x30); Back to basic instruction set}main () {lcd_init (); Initialize the LCD draw_pm (Zhu); Display the Set picture while (1); }
Physical map
Reprint please indicate the source, the DA! Original statement: This article is-sure-original works, when reproduced please indicate "transfer from-sure-" and the original link.
12,864-point Array LCD display