How to use C8051F020 microcontroller to drive and control the touch screen

Publisher:夜色迷离Latest update time:2017-12-25 Source: eefocusKeywords: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 and suitable input device for China's multimedia information query. It has many advantages such as durability, fast response, space saving, and easy communication. Touch screen technology is considered to be one of the mainstream directions of future human-computer interaction technology, and the application of related industries and products is also becoming a hot spot. However, traditional touch screens are difficult to apply to a wider range of industrial control equipment due to their high cost. At present, Wuhan Guxin Technology's touch screen design solution can solve this problem well, using touch screens, single-chip microcomputers and LCD screens to build a human-computer interface system.


    In the process of using C8051F020 to control TFT6448BS-5.7, bus control is adopted. Because the TFT6448BS-5.7 liquid crystal controller has a latch function, there is no need for an external latch chip when using bus control. It can be realized by using the P0, P2, and P3 ports of the single-chip 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 capacity of the corresponding connection pins of the P0, P2, and P3 ports is expanded; according to the control requirements, the pins of the corresponding ports are configured as drain output mode through the P0, P2, and P3 port registers. The P3 port is configured as a data/address output port. When outputting the address, it is the lower eight bits of the address bus, and the P2 port provides the high 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 valid. By writing data into the corresponding row, column, control and data registers of TFT6448BS-5.7, the C8051F020 chip can be used to control TFT6448BS-5.7, thereby realizing the display control of color LCD.

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

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

    2. Combine software programming to initialize AD0. When the system is in sleep mode, the software turns on interrupts, cuts off PNP 1, PNP2, and NPN 1, and saturates and turns on NPN2;

    3. Wait for the touch screen to be touched;

    4. If a touch occurs on the touch screen, enter the interrupt service program, turn off the external interrupt, and perform a short delay to eliminate external jitter. Determine whether the jitter has ended by judging the level change of the interrupt input port P0.0. Cut off PNP2 and NPN2 through software, saturate and conduct PNP1 and NPN1, select the analog-to-digital conversion channel AIN0.0, collect the X-direction coordinate value of the touch point, delay and wait for the conversion to end, and remove the conversion result; switch the electrode voltage, set it through software, cut off PNP1 and NPN1, saturate and conduct PNP2 and NPN2, select the analog-to-digital conversion channel AIN0.1, collect the Y-direction coordinate value of the touch point, delay and wait for the conversion to end, 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, reopen the interrupt and return to the main program;

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


Keywords:C8051F020 Reference address:How to use C8051F020 microcontroller to drive and control the touch screen

Previous article:51 MCU C Language Tutorial (I) Create the first project
Next article:Intelligent control system for medical infusion device based on Anxin No.1

Recommended ReadingLatest update time:2024-11-22 22:10

How to use C8051F020 microcontroller to drive and control the touch screen
     The touch screen is currently the simplest, most convenient, natural and suitable input device for China's multimedia information query. It has many advantages such as durability, fast response, space saving, and easy communication. Touch screen technology is considered to be one of the mainstream directions of f
[Microcontroller]
Transplantation of uC/OSII on C8051F020 MCU
1 uC/OS-II version and integrated development environment for C8051F020 microcontroller The µC/OS-II kernel uses version V2.52. Although Silicon Lab provides free integrated development environment for C8051F series microcontrollers, due to usage habits, the author still chose µVision2 V2.38A, the C compiler version i
[Microcontroller]
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号