With the widespread application of embedded systems, a large number of 16-bit and 32-bit embedded processors have emerged. The traditional 8-bit microcontroller has been used in production practice for a long time, with mature manufacturing technology and more reliable performance, and still occupies a considerable market, especially in the field of automotive electronics and other fields with extremely high reliability requirements. The LCD display module has the advantages of rich display information, low power consumption, small size, light weight, and no radiation.
As a special computer peripheral, touch screen is the most natural and convenient way of human-computer interaction. T32QM 6450 LCD module is a TFT color LCD display with touch screen function, with a resolution of 240×320 and supports 2.6×105 color display. It has powerful functions, easy use, simple interface, rich special control instructions, and can easily realize functions such as screen scrolling display and touch screen.
1 T32QM6450 LCD module structure
T32QM 6450 is a liquid crystal module, mainly composed of TFT-LCD display, LED backlight, touch screen, source driver IC IS2102 and gate driver IC IS2202. Source Driver is responsible for providing driving voltage for each pigment point on the column, while Gate Driver controls the strobe state of each row of pixels. Each pixel of TFT liquid crystal is driven by a thin film transistor integrated behind the pixel, so that screen information can be displayed at high speed, high brightness and high contrast, and the display grayscale can be accurately controlled. LCD is connected to the processor through the bus to realize the transmission of data and instructions.
2 T32QM6450 and W77E58 interface circuit
The hardware connection is shown in Figure 1. The processor chip is W77E58. This chip is a fast 8051 compatible microcontroller. Its core has been redesigned to improve the clock speed and memory access cycle speed. Its instruction set is basically the same as that of 8051, with an additional DEC DPTR instruction. 8051 has one machine cycle for every 12 clock cycles, while W77E58 has one machine cycle for every 4 clock cycles, which improves the instruction execution speed. In addition, W77E58 can also adjust the cycle of MOVX instruction, ranging from 2 to 9 machine cycles. This design enables W77E58 to access slow or fast external RAM and peripherals more effectively.
Figure 1 LCD screen and W77E58 hardware connection circuit
Because W77E58 is a high-speed 8-bit microcontroller, and the LCD module uses a 16-bit bus interface, two latches 74HC573 are used in the circuit, and the P24~P27 ports are used to control the latch enable and output enable pins LE (falling edge latch) and OE (low level valid) of the two latches respectively. First, give the LE of the first 74HC573 a high level, transmit the low 8-bit data through the P1 port, and then give the LE of the chip a low level to latch the current data; give the LE of the second chip a high level, and also transmit the high 8-bit data through the P1 port and latch it. Finally, give the OE of the two 74HC573s a low level at the same time to realize the transmission of 16-bit data.
This system is a mixed voltage system. The LCD module and ADS7843 are powered by 3.3 V, while the processor and latch are powered by 5 V. These two parts cannot be directly connected. Therefore, the level conversion problem must be handled well. Four bidirectional level conversion chips 74LVC4245 are used in the circuit, which can realize the mutual conversion between 3.3 V and 5 V.
To realize the touch screen function, a touch screen controller ADS7843 is used in the circuit. It is a resistive touch screen control chip with serial 12-bit A/D conversion function. In the off mode, the power consumption is only 0.5uW, and in the 12 V, 125 kHz working mode, the power consumption is 750uW3. This article only introduces the main functions in combination with the circuit. CS is the chip selection terminal; DCLK is the clock input terminal, which is input by the software analog clock signal of the P20 pin; DIN is the data serial input terminal, and the control data is input through this pin; X+, Y+, X-, Y- are the contact point coordinate data input terminals; INT is the interrupt pin, which is used to notify the MCU that a touch event has occurred, and DOUT serially outputs the converted touch position data to the MCU. [page]
3 LCD display programming
3.1 Reading and writing instructions and data
By setting the RS pin of the LCD module to 1 or 0, data or instructions can be transmitted between the processor and the LCD. When RS=1 is set, the data signal is transmitted; when RS=0 is set, the instruction signal is transmitted. The data received by the D8~D15 port of the module (i.e. the high 8 bits) represents the register number, and the control instruction is received by D0~D7. Some subroutines are as follows:
3.2 Display of characters, Chinese characters and colors
The above subroutine can be called to conveniently send control commands and color information to the LCD module. The T32QM 6450 module has a total of 158 registers. By calling the WriCom function, control commands can be written to the relevant registers, and then calling WriData to write 2 bytes of color information, the RGB format of which is: red is the upper 5 bits (Bit15~Bit11), green is the middle 6 bits (Bit10~Bit5), and blue is the lower 5 bits (Bit4~Bit0). After the above operations, colors, characters, images, etc. can be displayed at the specified position or area. If you want to display a character or Chinese character in color Color at the point with coordinates (X, Y) on the screen, as long as you know its dot matrix array, call WriData (Color) at each point to be displayed. The display principle of the picture is similar. Use the conversion tool to convert the picture into a C format array file. The following example is a program to display characters:
3.3 Scrolling display screen
To achieve the scrolling display effect of the screen in the specified area, you can set registers R75~R80, where registers R75 and R76 are used to set the starting line of the scrolling area; R77 and R78 set the range of the screen, that is, the number of lines to be scrolled; R79 and R80 set the number of lines to scroll each time, that is, the step length. It should be noted that the step length setting is not a one-time thing, because the step length here is relative to the state when the scroll screen is initialized, not relative to the last scrolling action. Figure 2 illustrates the scroll screen setting and demonstration effect.
Figure 2 Scrolling settings and process demonstration
The C program for the process shown in Figure 2 is as follows:
, the screen scrolls faster and the effect is not obvious.
In actual application, the timer can be combined to change the values of registers R79 and R80 at regular intervals. Generally, the values are assigned according to an increasing arithmetic progression, which can achieve a good visual effect. The maximum value assigned cannot exceed 319, because the screen has a maximum of 320 lines; when the assigned value is 319 and the values assigned to R75 and R76 are 0, the full-screen scrolling display can be achieved.
4 Conclusion
After the display system is debugged, it can display longitude, latitude, time and other signals in real time through the serial port and GPS module, and the display effect is good. The formal parameters of the subroutine given in this article are mostly 2-byte integer values, which can be directly used in 16-bit and 32-bit microcontrollers, with strong compatibility, and provide a method for its application in portable systems.
Previous article:Using a Remote Control to Make a Crystal Oscillator Frequency Tester
Next article:TTL watchdog circuit
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Ranking of installed capacity of smart driving suppliers from January to September 2024: Rise of independent manufacturers and strong growth of LiDAR market
- Industry first! Xiaopeng announces P7 car chip crowdfunding is completed: upgraded to Snapdragon 8295, fluency doubled
- P22-009_Butterfly E3106 Cord Board Solution
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- BLDC driver based on GD32
- The development board mounts the NFS server shared directory
- Origin of "Circuit Observation Room"
- Want to learn about Microchip PIC32MZ DA Disc Graphics Development Board? Welcome to sign up for the online seminar
- ADXL345 sensor acceleration detection in vibration environment
- Contactless facial recognition access control system
- Look! Moderator benefits have increased again! New rules for moderators announced
- Basic knowledge of NFC architecture and standards involved
- [Perf-V Evaluation] Exception (interrupt) handling of Hummingbird E203
- Calculation and setting of baud rate of msp430 microcontroller