Design of intelligent LCD touch screen and single chip microcomputer interface

Publisher:快乐旅行Latest update time:2011-11-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
As a common display device, LCD has the characteristics of low power consumption, small size, light weight, and large amount of displayed information. Especially in portable devices, it occupies an absolute mainstream position. For simple information display of characters or numbers, segment code LCD drivers are usually available. For complex information display, it must be displayed by dot matrix LCD drivers. Among the most common dot matrix LCD controllers/drivers, there are LCD drivers without Chinese character libraries and LCD drivers with Chinese character libraries. With the widespread application of embedded systems, a large number of 16-bit and 32-bit embedded processors have emerged
. However, traditional 8-bit microcontrollers have been used in production practice for a long time, with mature manufacturing processes and more reliable performance, so they still occupy a considerable market, especially in the field of automotive electronics with extremely high reliability requirements. Liquid crystal displays have the advantages of rich display information, low power consumption, small size, light weight, and no radiation. As a special computer peripheral, touch screen is currently the most natural and convenient way of human-computer interaction.
In microprocessor systems (MCS-51, C8051F, AVR, PIC, MPS430, DSP, and some industrial ARM), it is generally troublesome to design LCD displays, especially for large dot matrix or color LCD designs. First, you need to choose an LCD screen, which can be imported, domestic, without backlight, with backlight, size, number of dot matrix, monochrome, color, supply, price, etc. Then there are the issues of LCD drivers, such as how to connect to the selected LCD module, how to operate the display buffer, how to connect to the microcontroller, how to program the software, etc. In addition, since large-screen LCDs all work in graphic mode, it is also necessary to establish various character libraries (foreign languages, Chinese characters, graphic symbols, etc.) and study how to display these symbols and Chinese characters. When it is necessary to display curve graphics, relevant knowledge such as computer graphics is also required, and various algorithms are implemented using microcontroller programs. Usually, the design of a large-screen LCD display system will take up a lot of design time.
Here, the selection of the LJD-ZN series LCD display terminal can solve all the above problems. As long as the CPU is connected to the touch LCD display terminal through the RS 232 serial port, the color and monochrome LCD displays can be controlled by sending a few simple commands using the system CPU.

1 Introduction to LJD-ZN Series LCD Display Terminals
This product is a color LCD intelligent LCD terminal designed by Beijing Blue Ocean Microchip Company. The LJD-ZN-8400T model is a color 8.4-inch intelligent terminal. The LCD screen is 8.4 inches, the resolution is 640×480, and the shell size is 248 mm×192 mm. It can be installed on the panel of the main controller. The connection between LJD-ZD-8400T and the outside is realized through the interface on the back of the module. There is an RS 232 communication port on the back of LJD-ZN-8400T, which is used to connect to a controller with an RS 232 communication port. The RS 232 communication port is a 9-pin D-type female pin arrangement. The pin arrangement is shown in Table 1.


The module also has an RS 485 communication port, which is used to connect to a controller with an RS 485 or TTL communication port. The RS 485 communication port is a 9-pin D-type female socket with pin arrangement. See Table 2 for the pin arrangement.


For the secondary development of LJD-ZN-8400T intelligent terminal, there is a matching tool software, which can be run directly to easily realize the functions of picture download and font download. Users can choose the method they are familiar with on the computer, such as drawing software, Photoshop software, etc. The picture must be saved in *.bmp format. The size of the picture does not exceed 640×480 pixels, because LJD-ZN-8400T displays 640×480, and the excess part will not be displayed, which will only waste storage space.
Number of pictures: LJD-ZN-8400T can display 24-bit true color bitmaps, which is compatible with the lower; it can display 8 620×480 full true color pictures, which can be expanded to 17; 23 full 256 color pictures, which can be expanded to 48; 47 full 16 color pictures, which can be expanded to 100; 185 full monochrome pictures, which can be expanded to 400.

2. Description of control commands and data formats
The LJD-ZN-8400T display system provides a wealth of operation commands. Designers can use these commands to easily complete the design of various display functions.
(1) The display screen coordinate values ​​are all sent or received in BCD code (decimal) format. When designing the software, the BCD code is directly treated as hexadecimal and does not need to be converted.
For example: coordinate x=200, y=120, then the transmission format should be:

(2) If the received coordinate value is 01H, 23H, 10H, 80H, it means x=123, y=180.
(3) The data sent to the LCD display must be ASCII code. The data transmission process is as follows:
packet header + data type + (related control) + packet tail. Note: The packet header format is unified as FOH, 5AH bytes; the data type is the command of related different operations; the packet tail format is unified as A5H FOH
two bytes; for example, the baud rate setting command is 15H, and its format is as follows:
data packet header + data type + COM port + baud rate (2 bytes hexadecimal) + data packet tail. The

COM port is only set when communicating with a computer. If it is communicating with a COM port such as a microcontroller, it is generally set to 00H.
For example: use a baud rate of 2400b/s for communication settings, Sample: FO 5A 15 00 09 60 A5 FO. The default baud rate is 9600b/s when powered on. After powering on, the user can change it according to the LJD-ZN device communication protocol.

3 Programming of the interface between the single-chip microcomputer and the display terminal
3.1 Initialization of the single-chip microcomputer serial port

After the main control unit is powered on and reset, first set the serial port of the control core single-chip microcomputer to work in mode 1, with a rate of 9600b/s.
Serial port initialization setting program:

3.2 Control command sending program
The LJD-ZN-8400T display system provides a wealth of operating commands, and designers can use these commands to easily complete the design of various display functions. For example: baud rate setting, the command is 15H, the format is as follows:
data packet header + data type + COM port + baud rate (2 bytes in hexadecimal) + data packet tail

The COM port is only set when communicating with a computer. If it is communicating with a COM port such as a single-chip microcomputer, it is generally set to OOH.

[page]

For example: use the baud rate of 2400b/s for communication settings;
Sample: FO 5A 15 00 09 60 A5 FO program is as follows:

3.3 Touch position detection program design
LJD-ZN-8400T display terminal can output the touch position coordinates through the serial port according to the external touch position. In actual application, it is necessary to set the upper left corner coordinates and the lower right corner coordinates of the touch function area so that a touch function area can be determined. Therefore, according to the touch position coordinates output by the serial port, it can be judged whether the touch is in the determined function area and the corresponding function is executed.
The serial port output touch screen position coordinate data format is as follows:
data packet header + data type + XH + XL + YH + YL + flag bit + data packet tail

Description: The touch screen of LJD-ZN-8400T is divided into two key values: pressed and lifted, which are judged by the flag bit. The touch screen value is consistent with the screen resolution. The upper left corner is the starting position, the x coordinate is (00, 00), and the y coordinate is (OO, 00); the lower right corner is the maximum value, the x coordinate is (03, 19), and the y coordinate is (02, 39). The touch position judgment subroutine flow chart is shown in Figure 1.
When programming a user-defined touch key, you must first determine the x/y coordinate value of the touch point based on the data output by the serial port. When the x coordinate value of the touch point is greater than the defined upper left corner x coordinate value and less than the defined lower right corner x coordinate value, and the y coordinate value of the touch point is greater than the defined upper left corner y coordinate value and less than the defined lower right corner y coordinate value, it can be determined that the touch point is within the defined key range and the key function subroutine of the key is called. Otherwise, it is considered an invalid touch point.



4 Conclusion
With the development of modern microelectronics technology, the intelligence of various devices is getting higher and higher, and the requirements for operability are getting higher and higher. A good human-computer interaction interface is getting more and more attention from designers. This article introduces the interface and programming based on the LJD-ZN-8400T series intelligent touch LCD display terminal and single-chip microcomputer, which has a wide range of use value.

Reference address:Design of intelligent LCD touch screen and single chip microcomputer interface

Previous article:Design of intracranial hemorrhage detection equipment based on MSP430 microcontroller
Next article:Design of digital controlled DC current source based on SPCE061A single chip microcomputer

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号