Our Latest News

Graphic dot matrix liquid crystal display module and 51 microcontroller interface design

Graphic dot matrix liquid crystal display module and 51 microcontroller interface design

INTRODUCTION

As a display device, liquid crystal is widely used in instruments, meters, electronic devices and other low-power products with its unique advantages. In the past, most of the display parts of measurement and control instruments used LED type LCD display for parameter setting and result display, which showed little information, single form, poor human-machine interaction, and high operator requirements. The liquid crystal display (LCD) has the advantages of low power consumption, small size, light weight, ultra-thin and programmable drive, which are incomparable with other display methods. The human-machine interface is more friendly and the operation is more flexible and convenient, making it increasingly the preferred display device for intelligent instruments and test equipment. This paper introduces the pinout, structure and function of WGM-12832 LCD module with ST7920 as the driver, and details the hardware interface circuit and interface software programming method with AT89S51 microcontroller.

This image has an empty alt attribute; its file name is image-415.png

1 Structural Features and Operation of WGM-12832

1.1 Introduction of Dot Matrix LCD WGM-12832

WGM-12832 is a 128×32 dot matrix LCD with built-in ST7920 controller, and various applications of LCD can be realized by programming ST7920 controller.WGM-12832 has the following features: (1) it can display numbers, letters, special characters, graphics, curves and Chinese characters; (2) the display content is 128 (columns) × 32 (rows) dots, full-screen dot matrix, can display 2 lines of Chinese characters, 8 characters per line; (3) the IC comes with 8 139 16×16 dot matrix Chinese character libraries, 126 16×8 letter symbols, and provides 4 16×16 dot matrix custom word functions; (4) the interface with CPU adopts serial control; (5) low power consumption, maximum operating power consumption 15 mW.

The main hardware structure block diagram of WGM-12832 module is shown in Figure 1.

WGM-12832 has a total of 7 external pins, and its use of serial port to send commands and data has the advantage of satisfying the display purpose while occupying few CPU pin resources. Therefore, it can drive WGM-12832 LCD even when many low-end CPUs have fewer pins, meeting the needs of different microsystems.

1.2 WGM-12832 Control Instructions

The WGM-12832 has 2 instruction sets: the basic instruction set and the expansion instruction set. The basic instruction set includes the basic operations of the WGM-12832 LCD, such as determining whether the controller is busy, clearing the display, setting the address of the display, writing data and reading data. The expanded instruction set, on the other hand, maximizes the realistic display needs based on the basic instruction set. For example, it can set sleep mode to meet the demand of low power consumption; it can set graphic display to further diversify the display and provide a more humanized interaction.

The operation principle of microcontroller for WGM-12832 is: the microcontroller first confirms that the ST7920 is not in “busy” state internally. In other words, the BF bit is read and the ST7920 can receive new instructions only when the BF is 0. If the BF bit is not checked before sending the instruction, there must be a long delay between the previous instruction and this instruction to ensure that the previous instruction is executed. During operation, the ST7920 is controlled by the microcontroller’s clock signal and transmitted to the ST7920 through the data line. The ST7920 determines whether the data received is data, instructions, or the content to be displayed, and processes accordingly. When the processing is complete, the I/O port buffer block is removed and the “busy” flag is cleared. When writing data to RAM, each RAM bit address can be written to 2 bits of information (2 B) continuously, and when the second byte is written, the value of the address counter (AC) will be automatically added to 1, i.e., when writing content continuously, only the starting bit address needs to be set, and data can be written continuously to achieve the purpose. Because the ST7920 is a driver chip capable of controlling 128×64 dot matrix, the WGM-12832 uses only 1/2 of the resources of the ST7920. it should be noted that the contents in the DDRAM bit addresses 88 H to 8 FH and 98 H to 9 FH cannot be displayed in use. The contents of bit addresses 80H to 87H and 90H to 97H will be displayed in line 1 and line 2 respectively.

2 Interface circuit between microcontroller and WGM-12832 liquid crystal

The interface circuit between AT89S51 and LCD WGM-12832 module is shown in Figure 2. Since WGM-12832 adopts serial communication with fewer external pins, it is connected to the microcontroller by the direct connection method, i.e. the I/O port is directly connected to the LCD data line and control line, which is characterized by simplicity, intuitiveness and easy operation. In this circuit, software is used to simulate the timing of the LCD to achieve the correct display.

3 Software Programming

The software programming for WGM-12832 is developed in Franklin 51 language, which consists of two main parts, one is to write commands to the LCD and the other is to write data to the LCD. With these 2 basic subroutines, various practical display subroutines can be constructed. Since the LCD comes with its own internal Chinese character module, the Chinese character display can be realized by simply sending the code corresponding to the Chinese character, the code of which can be found in the ST7920 module’s data. For graphics and curve display, the principle is similar, only need to set the corresponding horizontal address and vertical address, and write the corresponding graphics code to the LCD module, then the content to be displayed can be displayed.

Send command subroutine.

4 Conclusion

With the increase of intelligence of instruments, meters, electronic devices, etc., the use of liquid crystal display modules for microcontroller systems is becoming more and more widespread. In the interface between microcontroller and LCD, the key is to meet the timing requirements of LCD; in the software programming, the key is to carry out the correct initialization, operation and code of display content. The above interface circuit and the corresponding program have been debugged and applied in practice.

    GET A FREE QUOTE

    FPGA IC & FULL BOM LIST

    We'd love to

    hear from you

    Highlight multiple sections with this eye-catching call to action style.

      Contact Us

      Exhibition Bay South Squre, Fuhai Bao’an Shenzhen China

      • Sales@ebics.com
      • +86.755.27389663