Driving control of touch screen by C8051F020 microcontroller

Publisher:leader5Latest update time:2024-01-08 Source: elecfansKeywords:C8051F020 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The touch screen is currently the simplest, most convenient, natural input device suitable for China's multimedia information inquiry and national conditions. It has many advantages such as durability, fast response speed, space saving, and easy communication. Touch screen technology is considered to be one of the mainstream directions of human-computer interaction technology in the future, and the application of related industries and products is also becoming a hot spot. However, the traditional touch screen is difficult to apply to a wider range of industrial control equipment due to its high cost. The current touch screen design solution of Wuhan Guxin Technology can solve this problem very well. It uses the touch screen, microcontroller and LCD screen to build a human-machine interface system.

In the process of using C8051F020 to control TFT6448BS-5.7, the bus method is used for control. Because the TFT6448BS-5.7 LCD controller has its own latch function, there is no need to add an external latch chip when using the bus method for control. It only needs to use the P0, P2, and P3 ports of the single-chip computer C8051F020. Before the system is powered on, since the typical operating voltage of C8051F020 is 3.3V and the operating voltage of TFT6448BS-5.7 is 5V, the driving capabilities of the corresponding connection pins of the P0, P2, and P3 ports are expanded; according to the control requirements, through P0, P2, P3 port register configures the pin of the corresponding port into a drain output mode. Configure port P3 as a data/address output port. When outputting an address, it is the lower eight bits of the address bus. Port P2 provides the high bit address; when transmitting data, it is an 8-bit data bus port. After the system is powered on, the chip select signal /CS of TFT6448BS-5.7 is enabled. By writing data to the corresponding row, column, control and data registers of TFT6448BS-5.7, the C8051F020 chip can be used to control the TFT6448BS-5.7, thus Realize display control of color LCD.


Driving control of touch screen by C8051F020 microcontroller
 

The specific working process of the touch screen hardware interface circuit is as follows:

1. For the circuit shown in Figure 2, connect the lines and connect the 3.3V DC power supply to the power input terminal and the reference voltage terminal;

2. Initialize AD0 in combination with software programming. When the system is in sleep state, the software turns on interrupts, turns off PNP1, PNP2, and NPN1, and turns on NPN2 in saturation;

3. Wait for the touch screen to be touched;

4. If a touch occurs on the touch screen, enter the interrupt service routine, turn off the external interrupt, and perform a short delay to eliminate external jitter. Determine whether the dithering ends by judging the level change of the interrupt input port P0.0. Cut off PNP2 and NPN2 through software, turn on PNP1 and NPN1 in saturation, select analog-to-digital conversion channel AIN0.0, collect the X-direction coordinate value of the touch point, wait for the end of conversion, and remove the conversion result; switch the electrode voltage and set it through software , cut off PNP1 and NPN1, saturate and conduct PNP2, NPN2, select the analog-to-digital conversion channel AIN0.1, collect the Y-direction coordinate value of the touch point, wait for the end of the conversion, and remove the conversion result;

5. By comparing the collected X and Y coordinate values ​​with the set key boundary values, if the comparison result is true, switch to the corresponding sub-page, otherwise, re-enable the interrupt and return to the main program;

6. The working process of the touch screen hardware interface circuit returns to step 3 and continues to wait for the next touch.


Keywords:C8051F020 Reference address:Driving control of touch screen by C8051F020 microcontroller

Previous article:UART extension implementation designed for C8051F310
Next article:MAX1166 typical application circuit

Latest Microcontroller Articles
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号