In the past, in order to read the touch point coordinates on a resistive touch screen into the microcontroller, a dedicated touch screen controller chip was needed, or a complex external switch network was used to connect the microcontroller's on-chip analog-to-digital converter (ADC). Sharp's LH75400/01/10/11 series and LH7A404 microcontrollers all come with an on-chip ADC with a touch-screen bias circuit that uses a successive approximation register (SAR) type of converter. These controllers enable direct interface between the touch screen sensor and the microcontroller, control all touch screen bias voltages without CPU intervention, and record all measurements. This article will detail the structure and implementation principle of four-wire, five-wire, seven-wire and eight-wire touch screens.
There are many ways to implement SAR, but its basic structure is very simple, see Figure 1.
This structure saves the analog input voltage (VIN) in a track/holder, and the N-bit register is set to an intermediate value (ie, 100. .0, where the most significant bit is set to 1) to perform a binary lookup algorithm. Therefore, the output of the digital-to-analog converter (DAC) (VDAC) is one-half of VREF, where VREF is the reference voltage of the ADC. After that, perform a comparison to determine if VIN is less than or greater than VDAC:
1. If VIN is less than VDAC, the comparator output is logic low and the most significant bit of the N-bit register is cleared.
2. If VIN is greater than VDAC, the comparator output is logic high (or 1) and the most significant bit of the N-bit register is held at '1'.
Thereafter, the control logic of the SAR moves to the next bit, and the bit is forced high, and the next comparison is performed. The SAR control logic will repeat the above sequence operation until the last bit. When the conversion is complete, an N-bit data word is obtained in the register.
Figure 2 shows an example of a 4-bit conversion process where the Y-axis and the thick line indicate the output voltage of the DAC.
Figure 2 4-bit conversion process
In this case:
1. The first comparison shows that VIN is less than VDAC, so bit  is set to zero. The DAC is then set to 0b0100 and a second comparison is performed.
2. In the second comparison, VIN is greater than VDAC, so bit  remains at 1. Subsequently, the DAC is set to 0b0110 and a third comparison is performed.
3. In the third comparison, bit  is set to 0. The DAC is then set to 0b0101 and the last comparison is performed.
4. In the last comparison, Bit  remains at 1 because VIN is greater than VDAC.
Touch screen principle
The touch screen includes two transparent layers stacked on top of each other. The four-wire and eight-line touch screens are composed of two transparent resistive materials having the same surface resistance. The five-wire and seven-wire touch screens are composed of a resistive layer and a conductive layer, usually Use an elastic material to separate the two layers. When the pressure on the surface of the touch screen (such as pressing through a pen tip or finger) is large enough, contact is made between the top layer and the bottom layer. All resistive touch screens use a voltage divider principle to generate voltages that represent the X and Y coordinates. As shown in Figure 3, the voltage divider is implemented by connecting two resistors in series. The upper resistor (R1) is connected to the positive reference voltage (VREF) and the lower resistor (R2) is connected to ground. The voltage measurement at the junction of the two resistors is proportional to the resistance of the resistor below.
Figure 3 The voltage divider is connected in series by two resistors.
In order to measure a coordinate in a particular direction on a resistive touch screen, a resistive layer needs to be biased: one side of it is connected to VREF and the other side is grounded. Also, connect the unbiased layer to the high impedance input of an ADC. When the pressure on the touch screen is large enough to make contact between the two layers, the resistive surface is divided into two resistors. Their resistance is proportional to the distance from the touch point to the offset edge. The resistance between the touch point and the ground side is equivalent to the one below the voltage divider. Therefore, the voltage measured on the unbiased layer is proportional to the distance from the touch point to the ground side.
Four-wire touch screen
The four-wire touch screen contains two resistive layers. One of the layers has a vertical bus on the left and right edges of the screen, and the other layer has a horizontal bus at the bottom and top of the screen, as shown in Figure 4. To make measurements in the X-axis direction, the left bus is biased to 0V and the right bus is biased to VREF. Connect the top or bottom bus to the ADC and make a measurement when the top and bottom layers are in contact.
igure 4 Two resistive layers of a four-wire touch screen
To make measurements in the Y-axis direction, the top bus is biased to VREF and the bottom bus is biased to 0V. The ADC input is terminated to the left or right bus, and the voltage is measured when the top layer is in contact with the bottom layer. Figure 5 shows a simplified model of a four-wire touch screen when two layers are in contact. For a four-wire touch screen, the ideal connection method is to connect the bus biased to VREF to the positive reference input of the ADC and the bus set to 0V to the negative reference input of the ADC.
Five-wire touch screen
The five-wire touch screen uses a resistive layer and a conductive layer. The conductive layer has a contact, usually at the edge of one side. There is one contact at each of the four corners of the resistive layer. To measure in the X-axis direction, the upper left and lower left corners are biased to VREF, and the upper right and lower right corners are grounded. Since the left and right corners are the same voltage, the effect is similar to that of the bus connected to the left and right sides, similar to the method used in the four-wire touch screen.
To measure along the Y-axis, the upper left and upper right corners are offset to VREF, and the lower left and lower right corners are offset to 0V. Since the upper and lower corners are respectively the same voltage, the effect is substantially the same as the bus connecting the top and bottom edges, similar to the method used in the four-wire touch screen. The advantage of this measurement algorithm is that it keeps the voltages in the upper left and lower right corners constant; but if grid coordinates are used, the X and Y axes need to be reversed. For a five-wire touch screen, the best way to connect is to connect the upper left corner (offset to VREF) to the positive reference input of the ADC and the lower left corner (offset to 0V) to the negative reference input of the ADC.
Seven-line touch screen
The seven-line touch screen is implemented in the same way as the five-line touch screen except that one line is added to the upper left and lower right corners. When performing a screen measurement, connect one line in the upper left corner to VREF and the other line to the positive reference end of the SAR ADC. At the same time, one line in the lower right corner is connected to 0V, and the other line is connected to the negative reference end of the SAR ADC. The conductive layer is still used to measure the voltage of the voltage divider.
Eight-line touch screen
In addition to adding one line to each bus, the eight-wire touch screen is implemented in the same way as a four-wire touch screen. For the VREF bus, one line is used to connect VREF and the other line is used as the positive reference input for the DAC ADC's digital-to-analog converter. For the 0V bus, one line is used to connect 0V, and the other line is used as the negative reference input for the DAC ADC's digital-to-analog converter. Any of the four wires on the unbiased layer can be used to measure the voltage of the voltage divider.
Check for contact
All touch screens can detect if a touch has occurred by pulling one of the layers with a weak pull-up resistor and pulling the other layer with a strong pull-down resistor. If the measured voltage of the pull-up layer is greater than a certain logic threshold, it indicates that there is no touch, and vice versa. The problem with this approach is that the touch screen is a huge capacitor and it may be necessary to increase the capacitance of the touch screen leads in order to filter out the noise introduced by the LCD. A weak pull-up resistor connected to a large capacitor can lengthen the rise time and may result in the detection of a false touch.
The four-wire and eight-wire touch screens measure the contact resistance, which is RTOUCH in Figure 5. RTOUCH is approximately proportional to the touch pressure. To measure the touch pressure, you need to know the resistance of one or two layers in the touch screen. The formula in Figure 6 gives the calculation method. It should be noted that if the measured value of Z1 is close to or equal to 0 (when the touch point is close to the grounded X bus during the measurement process), some problems will occur in the calculation, which can be effectively improved by using the weak pull-up method.