128*64 dot matrix LCD screen programming tutorial

May 06, 2017

Leave a message

Use the LCD screen (model JX12864K1G) in the PROTEUS simulation software) to explore the programming method of the dot matrix LCD screen; the LCD screen of this model does not have a font library inside, and can only create a font for character display (using method and graphics The display method is the same); the fonts can be extracted through the "font extraction" software, which can save manual modeling

Trouble.

电路图

Overall circuit diagram

Function description: The circuit uses AT89C52 as the controller, and the clock chip DS1302 is on the bottom left of the circuit; the LCD screen is used to display the current time, several Chinese characters, a small picture and so on;

Circuit connection:

(1) LCD module: E=P2AO; RW=P2A1; RS=P2 2; CS2=P2 3; CS1=P2^4; RST (reset signal) = 5V;

Data port DO~D7 connect to the single-chip microcomputer PO port;

(2) Clock chip DS1302: RST = P316; CLK = P1^6; SDA = P1^7;

The circuit simulation results are as follows:

128*64

First of all, we need to analyze the working principle of the internal controller of the LCD module: pin function:

Pin name LEVER

Pin function

vsso

Power ground

VDD

+5.0V

voltage

LCD drive voltage, (it is optional in PROTUES simulation software

vo

catch)

RS=0, means DB7~DBO are display data

RS

1/0

RS=1, which means DB7~DB0 are display command data R/W=1, E=1 data is read to DB7~DBO

R/w

1/0

R/W=O, E= "1→0", data is written to IR or DRR/W=O, the falling edge of E signal is latched DB7~DB0

E

1/0

R/W=1, E=1, DDRAM data is read to DB7~DBO

DBO~DB71/0

Data line

0: select chip (left half screen) letter

1/0

No

0: Select the chip (the right half of the screen)

No

1/o reset signal, low level reset VOUT-10V

LCD drive negative voltage (can not be connected in PROTUES simulation software)

12864 internal functional devices and related functions:

1. Instruction Register (IR)

IR is used to register the instruction code, which corresponds to the instruction register register instruction. When RS=0, the instruction code is written into IR under the action of the falling edge of E signal. 2. Data Register (DR)

DR is used to register data and corresponds to the data in the data register. When RS =1, the graph display data is written into DR under the action of the falling edge, or read from DR to the DB7~DBO data bus under the action of the high level of the E signal. The data transmission between DR and DDRAM is automatically executed inside the module.

3. Busy sign: BF

The BF logo provides internal working conditions. BF=1 means that the module is operating internally, and the module does not accept external commands and data at this time. When BF=0, the module is ready and can accept external commands and data at any time. Using the STATUS READ instruction, BF can be read to the DB7 bus to check the working status of the module.

4. Display control trigger DFF

This trigger is used to control the on and off of the module's screen display. DFF=1 means the display is on (DISPLAY OFF), the content of DDRAM is displayed on the screen, and DFF=0 means the display is off (DISPLAY OFF). The state of DDF is controlled by the command DISPLAY ON/OFF and RST signal.

5. XY address counter

The XY address counter is a 9-bit counter. The upper 3 bits are the X address counter, and the lower 6 bits are the Y address counter. The XY address counter is actually the address pointer of DDRAM, the X address counter is the page pointer of DDRAM, and the Y address counter is the Y address pointer of DDRAM.

X address (page address, the concept of page will be explained later) The counter has no counting function and can only be set by instructions.

The Y address (column address) counter has a cyclic counting function. After each display data is written, the Y address is automatically incremented by 1, and the Y address pointer is from 0 to 63. 6. Display data RAM (DDRAM)

DDRAM is to store graphics display data. A data of 1 indicates that the display is selected, and a data of 0 indicates that the non-display is selected. See the DDRAM address table for the relationship between DDRAM, address and display position.

7. Z address counter

The z address counter is a 6-bit counter, this counter has a cyclic counting function, and it is used to display line scan synchronization. When one line scan is completed, this address counter automatically increments by 1, and points to the next line scan data. The Z address counter is 0 after RST reset.

The z address counter can be preset with the command DISPLAY START LINE. Therefore, the starting line of the display screen is controlled by this instruction, that is, where the DDRAM data starts to be displayed on the first line of the screen. The DDRAM of this module has a total of 64 lines, and the screen can scroll through 64 lines.

Command system of 12864LCD




Send Inquiry