Hardware introduction:
430 digital IO port:
Msp430f149, msp430f169 has a total of 48 I/O Ports for each 8-bit P1-P6; a large number of I/O ports are available for use, so the 8-bit parallel data mode can be used for LCD control; each IO port of 430 is a two-way IO port, and its data transmission direction is controlled through registers, which is convenient and practical; for information about the I/O port of the MSP430 microcontroller, refer to the user guide and data manual provided by Texas Instruments.
Liquid Crystal ocmj4x8c:
This module displays letters, numbers, Chinese fonts, and graphics, and displays both the drawing and text. Three Control interfaces are provided: Eight-bit microprocessor interfaces, four-bit microprocessor interfaces, and serial interfaces (ocmj4x16a/B without serial interfaces ). All functions, including Ram and font generators, are included in a single chip. As long as there is a minimum microprocessing system, the module can be conveniently operated.
The built-in 2 m-bit Chinese font Rom (cgrom) provides a total of 8192 Chinese fonts (16x16 lattice) and 16 k half width font Rom (hcgrom) A total of 126 symbolic fonts (16x8 lattice) are provided, 64x16 fonts generate RAM (cgram), and the drawing display screen provides a drawing area (gdram) with 64 X points ), it can be mixed with text images.
Ocmj4x8c pin description:
Pin |
Name |
Direction |
Description |
1 |
VSS |
- |
Gnd (0 V) |
2 |
VDD |
- |
Supply voltage for logic (+ 5 V) |
3 |
NC |
- |
Supply voltage for LCD (suspended) |
4 |
RS (CS) |
I |
H: Data L: instruction code |
5 |
R/W (STD) |
I |
H: Read L: Write |
6 |
E (sclk) |
I |
Enable signal, valid at a high level |
7 |
Db0 |
I/O |
DATA 0 |
8 |
Db1 |
I/O |
Data 1 |
9 |
DB2 |
I/O |
Data 2 |
10 |
Db3 |
I/O |
Data 3 |
11 |
Db4 |
I/O |
Data 4 |
12 |
DB5 |
I/O |
Data 5 |
13 |
Db6 |
I/O |
Data 6 |
14 |
Db7 |
I/O |
Data 7 |
15 |
PSB |
I |
H: parallel mode l: serial mode |
16 |
NC |
- |
Empty foot |
17 |
/Rst |
I |
Reset signal, effective at low level |
18 |
NC |
- |
Empty foot |
19 |
Leda |
- |
Backlight positive pole (+ 5 V) |
20 |
Ledk |
- |
Negative backlight (0 V) |
Pin Connection Mode: PSB, RST connected to high level (3.3 V); RS connected to p3.0; R/W connected to p3.1; e connected to p3.2; DB0-DB7 connected to P5 port, power supply connected to 3.3 V (including backlight) Gnd ground (including backlight ).
Steps for displaying Chinese characters:
1. Ram (ddram)
The display data Ram provides 64x2 bytes of space, and can control up to 4 lines of 16 characters (64 words) of the Chinese font display. When you enter the display data Ram, the cgrom, hcgrom, and cgram fonts can be displayed separately. This series of modules can display three types of fonts: half-width hcgrom, cgram, and Chinese cgrom, selected from the encoding written in ddram, in bytes H ~ 0006 H fixed font, H ~ In the 7fh encoding, the semi-encoding will select the cgram self-wide English numeric font, And the encoding above A1 will automatically combine with the next byte, the two bytes are encoded to form a Chinese font.
Big5 (a140 ~ D75f) GB (a1a0 ~ F7ff), the detailed font encoding is as follows:
1). Display font half width: Write 8-bit data into ddram, range: 02h ~ 7fh encoding.
2) display cgram: Write 16-bit data into ddram. There are four types of codes: 0000 h, 0002 H, 0004 H, and 0006 H.
3). display Chinese characters: Write 16-bit data into ddram, range: a140h ~ D75fh encoding (big5), a1a0h ~ F7ffh encoding (GB ). Write 16-bit data into ddram by writing two bytes of data through a connection. Write the data to the high byte first (d15 ~ D8) then writes low bytes (D7 ~ D0 ).
2. Drawing RAM (gdram)
The drawing display Ram provides 64x32 bytes of memory space (the drawing RAM address is set by the Extended Instruction). It can control up to x 64 points of two-dimensional drawing buffer space. When you change the drawing Ram, set the gdram address by the expansion command, set the vertical address, and then set the horizontal address (write two bytes of data to complete the vertical and horizontal coordinate addresses), and then write two 8-bit data to the drawing Ram, the address counter (AC) will automatically add one. The steps for writing to the drawing RAM are as follows:
1) first write the vertical byte coordinate (y) into the drawing RAM address.
2). Write the horizontal byte coordinate (x) into the drawing RAM address.
3). Change D15 ~ D8 is written to Ram (the first bytes is written ).
4). Convert D7 ~ D0 is written to Ram (the second bytes is written ).
LCD display address:
For more information about liquid crystal, see section 12864.