Design of Resistive Touch Screen Interface Circuit Using ADS7846 Controller

Publisher:CaptivatingEyesLatest update time:2011-09-07 Keywords:ADS7846 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Structure of resistive touch screen

The detection component of the resistive touch screen is a multi-layer composite film that fits closely with the display surface. It is composed of a layer of glass or organic glass as the base layer, a resistive conductor layer (such as indium tin oxide ITO) coated on the surface, and a hardened, smooth and scratch-resistant plastic layer on the top. The inner surface of the plastic layer is also coated with a resistive conductor layer. There is an isolation layer with many tiny isolation points between the two conductor layers, which separates and insulates the two conductor layers, as shown in Figure 1. When a finger touches the screen, the two conductor layers come into contact at the touch point. The controller detects this connection point and calculates the X and Y coordinates. This is the detection principle of the resistive touch screen.


Resistive touch screens are divided into various structures such as 4 to 8 lines according to the number of lead lines. The 4-wire resistive touch screen is the most representative, and its detection principle is shown in Figure 2. A narrow electrode is placed on the upper and lower sides of the outer ITO layer, with the lead ends being Y+ and Y-, and a narrow electrode is placed on the left and right sides of the inner IT0 layer, with the lead ends being X+ and X-. In order to obtain the position signal of the touch point in the X direction, VREF and 0 V voltages are applied to the two electrodes X+ and X- of the inner ITO layer, respectively, so that a voltage gradient from 0 to VREF is formed on the inner IT0 layer. The voltage from the touch point to the X- end is the voltage divided by the two-terminal resistors to VR-EF. The voltage divided value represents the position of the touch point in the X direction. Then, one electrode (such as Y-) of the outer ITO layer is suspended, and the voltage divided can be taken from the other electrode (Y+). The voltage divided is converted by A/D and compared with VREF to obtain the X coordinate of the touch point.

In order to obtain the position signal of the touch point in the Y direction, it is necessary to apply VREF and OV voltages to the two electrodes Y+ and Y- of the outer ITO layer respectively, and leave one electrode (X-) of the inner ITO layer suspended, and take the divided voltage of the touch point in the Y direction from the other electrode (X+).

2 Features of ADS7846

2.1 Basic Features

ADS7846 is a new generation of 4-wire touch screen controller launched by BB Company in the United States. It consists of low on-resistance analog switches, successive approximation ADC with sampling/holding function, asynchronous serial data interface, temperature sensor, etc. ADC is the core of ADS7846, with a conversion rate of up to 125 kHz and a programmable resolution of 8 or 12 bits. The device not only has the function of measuring X and Y coordinates, but also has four measurement functions: battery voltage, chip temperature, touch pressure and external analog quantity. Its working mode can be determined by the control word. The 6-to-1 analog multiplexer in the chip can select one of the 6 voltage quantities (X+, Y+, Y-, VBAT, TEMP, AUX-IN) according to the command word sent by the microcontroller, and send it to the A/D converter for conversion, and then send the conversion value to the microcontroller through the SPI interface. ADS7846 also integrates a touch recognition circuit. When a touch is detected, the circuit will output a low-level signal at the pin to make an interrupt request to the microcontroller to measure the coordinates of the touch point. The chip is powered by a single power supply with an operating voltage of 2.2 to 5.25 V and an internal +2.5 V reference voltage.

2.2 Pin Function

The pin arrangement of ADS7846 is shown in Figure 3, and the pin functions are shown in Table 1.

Pin Function

2.3 Control Word

The control function of ADS7846 is mainly to realize the switching of touch screen electrode voltage and A/D conversion of touch point position signal. The control word of ADS7846 is as follows:

Control word of ADS7846

S: Data transmission start flag. If it is 1, it means a new control byte has arrived; if it is 0, the data on the DIN pin is ignored.

A2A1A0: Channel selection bit. Used to control the input of the channel selector, the touch signal drive switch and the reference input voltage of the ADC. When A2A1A0=001, the Y coordinate signal is collected; when A2A1A0=101, the X coordinate signal is collected.

MODE: Used to select the precision of A/D conversion. 1 selects 8-bit precision; 0 selects 12-bit precision.

Used to select the reference voltage input mode. 1 is the reference voltage non-differential input mode; O is the reference voltage differential input mode.

PD1, PD0: Low power mode selection bits. If it is 11, the device is always in the power supply state; if it is 00, the device is in low power mode between two conversions.

2.4 Conversion Timing

The conversion timing of ADS7846 is shown in Figure 4. A complete electrode voltage switching and A/D conversion requires three serial data transmissions between ADS7846 and the microprocessor, and each transmission requires eight clock cycles.

Conversion Timing

The first transmission is from the microprocessor to send the control word to ADS7846, and the next two transmissions are the microprocessor reading the conversion results from ADS7846 (the last 4 bits are automatically filled with 0). Since the serial port supports bidirectional transmission at the same time, and the reading and the next control word can overlap, the conversion rate can be increased to 16 clock cycles each time.

2.5 Touch Coordinate Calculation

Since the Y-direction voltage increases gradually from bottom to top and the X-direction voltage increases gradually from right to left in a four-wire resistive touch screen, the coordinate origin corresponding to the Y and X-direction voltages is in the lower right corner of the touch screen. In order to obtain the X and Y coordinate values ​​used in engineering (i.e., move the coordinate origin to the lower left corner), the X-position voltage conversion value should be complemented. In addition, the X and Y position voltage conversion values ​​must also correspond to the dot matrix of the display screen (the liquid crystal used is a 240×160 dot matrix). Therefore, the calculation formula for the corrected X and Y coordinates is:

Coordinate calculation formula

Where: Xmax, Xmin are the maximum and minimum values ​​of the voltage conversion result at the X position; Ymax, Ymin are the maximum and minimum values ​​of the voltage conversion result at the Y position; Y, X are the conversion values ​​of the voltage at the touch point; x, y are the corrected coordinates of the touch point.

3 Interface between touch screen and microcomputer

3.1 Interface Circuit

The interface circuit between the touch screen and the 80C55 microcontroller using ADS7846 is shown in Figure 5. The X+, X-, Y+, and Y- of the touch screen are connected to the corresponding terminals of the ADS7846. When A2A1-A0=001 in the control word, X+ is connected to the power supply VCC and X- is grounded by switching the on-chip analog switch. The Y+ and Y- terminals are connected to the input terminals of the A/D converter in a differential form. The result of the A/D converter is the Y position voltage. Similarly, when A2A1A0=101 in the control word, the result of the A/D converter is the X position voltage. When the data transmission between the microcontroller and ADS7846 adopts serial communication mode, the microcontroller serial port modes 1 to 3 are different communication modes, which do not match the timing of ADS7846; serial port mode 0 is a register mode, although it can match the timing of ADS7846, the serial port data input/output uses the same terminal RXD (TXD) as the synchronous pulse output terminal), and the ADS7846 data input/output uses different terminals DIN and DOUT. In order to achieve correct bidirectional data transmission, a bidirectional data chip GAL is designed. The function of this chip is that when E=O, the data transmission direction is Y to A; when E=1, the transmission direction is B to Y. The pen interrupt signal of ADS7846 is connected to P2.4. When the signal is valid, the microcontroller sends the control word. The busy signal BUSY of ADS7846 is connected to P2.6. At the falling edge of the BUSY signal, the microcontroller receives the A/D conversion result.

ADS7846 realizes the interface circuit between touch screen and single chip computer 80C55

3.2 Interface Program

When the touch screen is touched, the ADS7846 interrupt signal is valid. After the MCU detects this valid signal, it first sends the X coordinate measurement control word and detects whether the BUSY signal has a falling edge. After the falling edge arrives, it reads the X position voltage; then sends the Y coordinate measurement control word to obtain the Y position voltage. The obtained X and Y position voltages are calculated using formulas (1) and (2) to obtain the X and Y coordinates of the touch point. The software flow is shown in Figure 6.

Software Process

4 Conclusion

The designed touch screen interface circuit has the following advantages: by adding a two-way transmission GAL chip, the serial communication problem between the 51 series microcontroller and the touch screen controller ADS7846 is solved; by correcting the voltage at the touch point position, the correct touch coordinates are obtained; the interface circuit is easy to implement and has strong practicality.

Keywords:ADS7846 Reference address:Design of Resistive Touch Screen Interface Circuit Using ADS7846 Controller

Previous article:Design of Stable Operation of 51 Single Chip Microcomputer in Microcomputer Automatic Switching System
Next article:Using MCS51 single chip microcomputer to drive stepper motor circuit and program

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号