Design and implementation of serial interface between single chip microcomputer and LCD

Publisher:chi32Latest update time:2011-12-15 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction
LCD liquid crystal display devices are used as information display interfaces for intelligent instruments. They have the characteristics of low voltage, low power consumption, and clear display. Nowadays, they are widely used in low-power intelligent instruments. The JM240128A LCD used in this article is a graphic dot matrix LCD display, which consists of a controller T6963C, a row driver/column driver, and a 240×128 full dot matrix LCD display. It can display graphics and 15×8 (16×16 dot matrix) Chinese characters. The biggest feature of T6963C is its unique hardware initial value setting function. The parameters required for display driving, such as duty cycle coefficient, the number of bytes/rows transmitted by the drive, and the font selection of characters, are all set by the pin level. In this way, the initialization of T6963C is basically set when it is powered on, and the main focus of software operation can be fully used in the design of the display screen.
The 8-bit PIC series microcontrollers launched by Microchip Technology of the United States use a reduced instruction set (RISC), Harvard bus (Harvard) structure, and a two-stage pipeline instruction fetching method. They are practical, low-priced, have a small instruction set, low power consumption, high speed, small size, powerful functions, and are easy to learn. PIC16F774 belongs to a type of PIC mid-range series microcontrollers. It uses a 14-bit RISC instruction system. While maintaining a low price, it adds many functions such as A/D, internal EEPROM memory, comparison output, capture input, PWM output, I2C and SPI interfaces, asynchronous serial communication (USART) interface, analog voltage comparator, LCD driver, FLASH program memory, etc. It is a very powerful microcontroller. As long as its internal resources are fully utilized, a fully functional system can be formed with very few peripheral circuits.
1 Hardware circuit design of LCD module and PIC microcontroller
In this article, the connection between the PIC16F774 microcontroller and the JM240128A LCD module adopts an indirect control method, and its hardware circuit connection is shown in Figure 1.

Figure 1 Hardware circuit connection diagram of PIC16F774 microcontroller and JM240128A liquid crystal display module
In order to save the limited I/O port resources of the PIC microcontroller, the data transmission adopts serial transmission mode, and the serial/parallel conversion of the data is performed through the eight-bit serial input/parallel output shift register 74HC164 chip, and the data is transmitted to the LCD liquid crystal display module in parallel. In Figure 1, RA4 transmits data, RA2 provides clock pulses, and the C/D, /RD, and /WR control signals are directly controlled by PIC16F774 through RB3, RB2, and RB1. Since the integrated chip 74HC164 is a high-speed device, it meets the refresh rate requirements of the LCD. In this article, 74HC164 is only used for the liquid crystal display module, so the /CE signal can be grounded. The V0 pin in the JM240128A liquid crystal display module is the liquid crystal drive voltage. Since the module has its own negative voltage, the pin is suspended in Figure 1. If an external negative voltage is required, connect it to the VOUT pin.
The 8-bit edge-triggered shift register 74HC164 used for data serial/parallel conversion is a high-speed silicon gate CMOS device compatible with low-power Schottky TTL (LSTTL) devices. Data is serially input through one of the two input terminals (A or B). Either input terminal can be used as a high-level enable terminal to control the data input of the other input terminal. The two input terminals can also be connected together, or the unused input terminal can be connected to a high level, but it must not be left floating. Every time the clock (CP) changes from low to high, the data is shifted right by one bit and input to Q0. Q0 is the logical AND of the two data input terminals (A and B), which maintains a setup time length before the rising clock edge.
The LCD controller T6963C contains 67 pins. After being embedded in the LCD display module, it realizes the interface of row and column drive and display buffer. Therefore, we only need to connect a small number of pins to the microcontroller to realize complex Chinese, English and graphic display. There are two types of interface circuits between the LCD display module and the microcontroller: direct control and indirect control. This article adopts the latter control method.
The structural features and working principle of the T6963C controller are as follows:
T6963C is a dot matrix LCD graphic display controller. The character font is set by hardware. It can be displayed in graphics, text, and graphics and text synthesis, as well as feature display in text mode. It can also realize graphics copy operation, etc. It has an internal character generator CGROM with a total of 128 characters. T6963C can manage 64K display buffer and character generator CGRAM. It allows MPU to access the display buffer at any time and even perform bit operations. The initialization setting of T6963C is generally completed by pin setting, so its instruction system will focus on the setting of display function. T6963C instructions can have one or two parameters, or no parameters. The execution of each instruction is to first send in the parameters (if any) and then send in the instruction code. The interface between T6963C and row and column drivers and display buffer RAM has been realized on the LCD display module with built-in T6963C. At the same time, the structure of the LCD screen (single or double screen), data transmission mode, display window length, width, etc. have been set by hardware.
2 Software control of LCD module and PIC microcontroller
Software design flow chart
The data transmission and display between PIC microcontroller and LCD liquid crystal display module is realized by controlling the operation of T6963C. The software program flow is shown in Figure 2.
2.2 LCD driver subroutine
The system instruction set of the LCD display module is the instruction set of the T6963C controller. The instructions of T6963C can take 1 or 2 parameters, or no parameters. The function of the LCD driver subroutine is to read and write the LCD. [page]

2.3 T6963C Initialization
The LCD display must be initialized before use. In addition to setting the program stack pointer, the initialization mainly sets the functions of the control chip T6963C in the LCD module, such as text/graphics first address and area settings, text/graphics switch, cursor shape setting and flashing switch, mode setting and screen clearing, etc.
2.4 Display of Chinese characters
The display of characters in the LCD display module can be realized in two ways: text display and graphic display. Here we focus on the method of displaying Chinese characters in graphic form.
The 240×128 dot matrix LCD display module can display 15×8 Chinese characters. For the display of each Chinese character, the address of the Chinese character in the character library should be calculated first, and then the font code of the Chinese character should be read out. When the display reaches the end of a line, it should be displayed in a new line.
When displaying Chinese characters, a 16×16 Chinese character font code occupies 32 bytes, and each line of display requires 2 bytes; when the second line is displayed, the display address should be added to the first byte address of the previous line by 30, and a total of 16 cycles are required to fully display a Chinese character.
When processing Chinese character display, if you want to realize the reverse display of Chinese characters (for example, to realize menu operation), the 32-byte font data of Chinese characters is XORed (XRL) with 0xFF, or inverted (CPL) before displaying.
In this system, it is also necessary to display numbers, letters and cursors, which are all displayed in a graphical 16×8 dot matrix. The display method of 16×8 dot matrix is ​​similar to that of 16×16 dot matrix display, so I will not repeat it here.

Figure 2 Program Flowchart
3 Application of LCD Module in Medical Instruments
The interface between the LCD display module and the PIC microcontroller introduced in this article adopts the data serial transmission method, which not only saves I/O port resources, but also makes data transmission more stable and reliable, and operation control more flexible and convenient. This method has been successfully applied to the research and development of semi-automatic biochemical analyzer products. Practice has proved that the LCD screen has a clear display effect and no flicker, which meets the display requirements of the biochemical analyzer.

Figure 3 Schematic diagram of semi-automatic biochemical analyzer
The semi-automatic biochemical analyzer uses PIC16F774 as the main chip, and is composed of aspiration and washing circuit module, filter rotation module, multi-stage amplification circuit module, temperature control module, and peripheral input and output devices such as micro-printer, LCD liquid crystal display module and membrane keyboard. The principle is shown in Figure 3. The measurement results can not only be displayed in the form of characters on the LCD screen, which is beautiful and convenient, and easy to read data directly, but also can be printed out through the micro-printer for further analysis and research. The use of the membrane keyboard can realize functions such as page turning query and data entry. Due to the limited I/O port resources of the PIC16F774 microcontroller, the LCD liquid crystal display module and the micro-printer interface both exchange data with the PIC16F774 microcontroller in serial mode, which effectively solves the interface problem. The application of the LCD liquid crystal display module also provides a guarantee for the low power design of the entire system.
4 Conclusion
The author's innovation lies in the serial interface design between the microcontroller and the LCD display module, and the use of the high-speed eight-bit serial input/parallel output shift register 74HC164 for data serial/parallel conversion, which has fast execution speed and high refresh rate, meeting the display requirements of LCD in biochemical analyzers. Practice has proved that the use of graphic dot matrix JM240128A LCD module as the display terminal of intelligent instruments has standardized interfaces and beautiful interfaces. Since the electrical characteristics and hardware circuit interfaces of most LCD models are very similar, the method used in this article is generally applicable.

Keywords:MCU Reference address:Design and implementation of serial interface between single chip microcomputer and LCD

Previous article:A low-power mass storage system for single-chip microcomputer based on USB flash drive
Next article:Data Monitoring System Based on VC++

Recommended ReadingLatest update time:2024-11-16 19:56

51 microcontroller-STC89C52 series learning Part 2: Register learning
Learning a microcontroller is actually learning how to operate registers. The 51 microcontroller uses sfr to define registers with special functions. For example: sfr P1 = 0x90; If you want to use bit 1 of the P1 port to light up the LED, assuming that the high level lights up, you can do this: Method 1: sfr P1 = 0x90
[Microcontroller]
51 microcontroller-STC89C52 series learning Part 2: Register learning
Description of the USB (D12) data communication process between PC and MCU
When communicating with netizens about the development experience of D12, I found that some netizens were confused about the process of data exchange between PC application software and MCU. They did not understand how PC application software sent data to MCU and how MCU sent data to PC application software through D12
[Microcontroller]
Four steps to learn MCU
How to learn MCU? What are the steps to learn MCU? MCU enthusiasts often ask us. We have roughly summarized that the process of learning MCU can basically be divided into four stages: The first stage: First, browse the hardware part in the textbook to roughly understand the hardware structure of the microcontro
[Microcontroller]
stc single chip computer uninterruptible power download program
STC microcontroller supports serial port ISP program download, no need to use a dedicated downloader, only use the serial port to download the program. But each time you download the program, you have to turn off the power and then turn it on, which is troublesome. The following is a method to download programs withou
[Microcontroller]
stc single chip computer uninterruptible power download program
DIY PIC microcontroller programmer circuit PCB
Introduction: K128PICP MCU programmer, made by foreign PIC MCU enthusiasts, is suitable for reading and writing nearly 100 types of PIC MCU F series chips. The programmer uses USB interface programming and draws power from USB. The programming high voltage is obtained by double voltage rectification of the pulse signa
[Microcontroller]
DIY PIC microcontroller programmer circuit PCB
Detailed analysis of the working mode of the microcontroller IO port
The working modes of the microcontroller I/O port are basically divided into the following categories: 1. Quasi-bidirectional IO port configuration (weak pull-up) summary: Strong current sinking capability, weak current sourcing capability Before reading the external status, latch "1" (disconnect the pull-down
[Microcontroller]
Detailed analysis of the working mode of the microcontroller IO port
Data storage and management of single chip microcomputer system
  introduction   In the field of automated testing, single-chip microcomputer test systems have been increasingly widely used with their mature application system, simple system structure and excellent cost performance. In recent years, with the continuous emergence of new test objects and the continuous development
[Microcontroller]
Data storage and management of single chip microcomputer system
Arduino CEO interview: AI-enabled MCUs can help more people stop being technology “spectators”
Translated from MIT Technology Review Since its inception in 2005, the Arduino open source platform has revolutionized the world of electronic engineering, and innovation represented by open source has swept the entire technology development. Whether in the past, present or future, the goal of science
[Embedded]
Arduino CEO interview: AI-enabled MCUs can help more people stop being technology “spectators”
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号