. 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.
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- If I use a battery to power a DCDC circuit, how can I be sure that the battery has enough power?
- Standard USB keyboard data packet
- 【Small home weather station】+ Hardware design, board proofing
- Forever power_A tiny device that turns your universal power bank into an uninterruptible power supply
- 【NUCLEO-WL55JC2 Review 2】Introduction to NUCLEO-WL55JC2 Development Board
- Award-winning live broadcast: Keysight Technologies 100G/400G optical communication test solutions
- [Full cash back for orders, capped at 300 yuan] MPS Mall Power Design Products Recommendation, Huge Discount Experience Season!
- [CH549 Review] Part 4 Low-Level Driver Software Review - Touch Button Driver
- 【AT32F421 Review】+ DHT22 Temperature and Humidity Detection
- Crazy Shell AI open source drone GPIO (remote control indicator light control)