circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 114 January 2000
Reach Out and Touch
Designing a Resistive Touchscreen


An Inside Look

Resistive touchscreens almost all start with a glass or hard plastic substrate, onto which a thin, transparent conductive layer (usually ITO) has been applied. Figure 1 illustrates a typical touchscreen cross-section.

(Click here to enlarge)

Figure 1Most resistive touchscreens have a construction similar to the one shown here. Two conductor layers are separated by a layer of tiny dots. The dots allow the two planes to make contact when force is applied to the top layer.

A fine grid of spacer micro dots is then applied and another layer of a conductive-coated flexible plastic (usually Mylar) is laid on top. You end up with two transparent conductive planes of material separated by a few thousandths of an inch. Pressure from a stylus or finger causes the two planes to make electrical contact and forms the means of sensing the touch.
There are two commonly used types of resistive touchscreens. These are called 4-wire and 5-wire. In a 4-wire resistive touchscreen, the two planes each have two wires connected to opposite ends.
For example, the x plane would have wires connected to the left and right edges, and the y plane would have wires connected on the top and bottom edges (see Figure 2). In operation, a controller must first apply a voltage across the x plane thereby forming a gradient because of the resistive coating.

a)

b)

(Click here to enlarge)

Figure 2aA 4-wire touchscreen has bus bars on the right and left edges of one layer, and on the top and bottom edges of the other layer. b—A 5-wire version has four leads, each connected to the corner of the bottom layer, and one lead connected to the top layer that works like a potentiometer wiper.

A touch is sensed by using the y plane as an input to an ADC and detecting a voltage when the two planes are forced together. The ADC reading will vary as a function of the x (right/left) position of the touch.
The y position is then calculated by removing the voltage from the x plane and applying it to the y plane, from top to bottom. The x plane is then used as a pickoff and its output is routed to the ADC.
In a 5-wire resistive touchscreen like the one shown in Figure 2b, the operation is similar, but the alternating x and y fields are applied across only one plane, and the other plane is used solely as a pickoff. Thus, one wire goes to each corner of the bottom plane, and a fifth wire is connected to the top plane.
To read an x position, the controller applies a voltage to the left two corners and ground to the right two. The fifth wire would go to the ADC. To read a y position, the controller grounds the bottom two corners and applies a voltage to the top two.

Smorgasbord of Options

There are several different ways of interfacing the glass touchscreen to your system. I’m going to show you four methods I’ve used with success. Two of the methods use a combination of a PIC and a touchscreen controller chip, one uses only a PIC, and the last uses no processor at all. Which method you use depends on your system requirements for scan rate, accuracy, and cost.
Interfacing to either a 4- or 5-wire touchscreen is easy thanks to a pair of chips from Burr-Brown. The ADS7843 is designed to interface to a 4-wire touchscreen, and the ADS-7845 to a 5-wire. The devices have identical hardware and control interfaces, differing only in the type of touchscreen they interface to.
Figures 3 and 4 show examples of circuits using a PIC and the devices to interface to both 4- and 5-wire touchscreens. Let’s take a look at each circuit and chip individually, starting with the 4-wire device.
The ADS7843 is a single-chip interface to a 4-wire touchscreen. At its core is a 12-bit successive approximation analog-to-digital converter (ADC). It performs all the front-end analog multiplexing necessary to generate the required voltage gradients across the touchscreen planes and switch the pickoff into the ADC.

(Click here to enlarge)

Figure 3—3 chips are all you need for this circuit. The ADS7845 handles the analog functions and the PIC performs the sequencing, scaling, and messaging formatting. The MAX232 handles the RS-232 level shifting.

(Click here to enlarge)

Figure 4—By swapping an ADS7845 into the circuit shown in Figure 3, we can create a 5-wire controller. The ADS7843 and ADS7845 are 12-bit devices that provide resolution capability up to 1/4096 of the touchscreen width.


As shown in Figure 3, a PIC and an RS–232-level shifter are all that’s required to build a 4-wire interface to a PC com port. The PIC-to-ADS7843 interface is simple, needing only three lines—clock, data, and chip select.
In the example circuit, the data input and output lines from the ADS7843 are tied together via a 10-kW resistor. This arrangement allows the use of a single PIC I/O line to handle both. Also shown is a PIRQ, or pen interrupt signal that can alert the PIC to the presence of a touch (or pen in a PDA application), and a BUSY signal that enables the PIC to monitor the status of the ADC conversion. The latter two signals are not used in my application, but are brought into the PIC for future use, if needed.
Figure 5 shows the logic diagram and timing of the PIC interface. This timing is called 24-clock mode, referring to the single byte of control info sent to the device and the two bytes returned. Other modes are also available and overlap the shifting of data in and out to save transit time, providing an ability to get more samples per second.

(Click here to enlarge)

Figure 5Eight clocks are used to shift out a control byte from the PIC to the device and another 16 clocks are used to retrieve the result. Since the data input and output lines are not simultaneously active, it’s possible for them to share the same microcontroller I/O pin.

To read the touchscreen, the PIC must send an 8-bit control byte to the ADS7843. This byte always has its most significant bit or start bit set. The next three bits (A2, A1 and A0) specify whether we want to read x, y, or one of the two Auxiliary ADC inputs.
The auxiliary inputs, with proper signal conditioning, can be connected to any system analog value you might want to read (e.g., a battery voltage). The next bit is called MODE and is set to zero if you want a 12-bit conversion, or a one if you want an 8-bit conversion. The following bit is called SER/DFR and is set to zero if you want to use a differential voltage reference (normally preferred) or is set to one for a single-ended type.
Lastly, the final two bits in the control byte are called PD1 and PD0. These are the power down mode select bits. If both are low, the device is powered down between conversions to save power for portable applications. If both are high, then the device is always enabled. An important fact is that the PIRQ, or pen interrupt is disabled when either of the two bits is set high. Thus, you can’t use the PIRQ if you leave the device always powered.
So, if the PIC wants to read the x channel, it sends a $93 to the ADS7843. This selects not only that channel, but also a 12-bit conversion, differential referencing, and nonpowerdown operation. After clocking out these eight bits to the ADS7843, in return, the PIC clocks in 16 bits that contain the 12-bit result and four zero-filled trailer bits. To read the y channel, the PIC performs the same operation, only sending a $D3 for the control byte.