4-Wire and 8-Wire Resistive Touch-Screen Controller Using The MSP430™
4-Wire and 8-Wire Resistive Touch-Screen Controller Using The MSP430™
ABSTRACT
This application report describes how to use an MSP430™ microcontroller to drive and read a resistive
touch screen. The hardware and software solutions provided enable the reading of user input through a 4-
wire or 8-wire resistive touch screen with a low-cost low-power customizable microcontroller. The
reference design includes MSP430 software and hardware schematics along with a demonstration PC
application. The design was implemented using an MSP430F2012, but it can easily be modified to use
any other MSP430 with an ADC.
Contents
1 Principles of Operation ..................................................................................................... 2
2 MSP430 Implementation ................................................................................................... 5
3 Demonstration System ..................................................................................................... 9
4 References ................................................................................................................. 10
List of Figures
1 Touch Detection ............................................................................................................. 2
2 4-Wire Touch-Screen Construction ....................................................................................... 3
3 4-Wire Touch Coordinate Reading ....................................................................................... 3
4 8-Wire Touch-Screen Construction ....................................................................................... 4
5 8-Wire Touch Coordinate Reading ....................................................................................... 4
6 MSP430 Touch Detection Connections .................................................................................. 5
7 Schematic .................................................................................................................... 6
8 Software Flow Charts....................................................................................................... 7
9 Communication Format .................................................................................................... 8
10 Hardware Setup ............................................................................................................. 9
11 PC Software ................................................................................................................ 10
List of Tables
1 Resources Used ............................................................................................................ 5
SLAA384A – February 2008 – Revised November 2010 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ 1
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
Principles of Operation www.ti.com
1 Principles of Operation
Y+ High Y+ Low
X– X+ X– X+
Y– Y–
2 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ SLAA384A – February 2008 – Revised November 2010
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
www.ti.com Principles of Operation
Y+ X+
Conductive bars
X– Y–
Glass
Transparent conductor
(top side)
The x and y coordinates of a touch on a 4-wire touch screen can be read in two steps. First, Y+ is driven
high, Y– is driven to ground, and the voltage at X+ is measured. The ratio of this measured voltage to the
drive voltage applied is equal to the ratio of the y coordinate to the height of the touch screen. The
y coordinate can be calculated as shown in Figure 3. The x coordinate can be similarly obtained by driving
X+ high, driving X– to ground, and measuring the voltage at Y+. The ratio of this measured voltage to the
drive voltage applied is equal to the ratio of the x coordinate to the width of the touch screen. This
measurement scheme is shown in Figure 3.
VX+ VY+
y= × heightscreen x= × widthscreen
VDrive VDrive
Y+ Read Y+
VDrive
X– X+
Read X+
Y–
SLAA384A – February 2008 – Revised November 2010 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ 3
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
Principles of Operation www.ti.com
Y– sense
X– drive Y– drive
X– sense Glass
Transparent conductor
(top side)
In comparison to a 4-wire touch screen, an 8-wire touch screen adds sense wires to the end of each of
the conductive bars. This allows any voltage offset created by the wiring or drive circuitry to be calibrated
out during operation.
An 8-wire touch screen is calibrated by measuring voltage extremes on either coordinate. First, Y+ drive is
driven high and Y– drive is driven low. The corresponding voltages measured at Y+ sense and Y– sense
are denoted VYmax and VYmin. A similar procedure yields VXmax and VXmin. These are the maximum and
minimum possible voltages across each coordinate.
The coordinates of a touch on an 8-wire touch screen can be read by first driving Y+ drive high, driving Y–
drive to ground, and reading the voltage at X+ sense. Using the maximum and minimum results obtained
during calibration, the y coordinate can be calculated as shown in the equations in Figure 5. The x
coordinate can be obtained by driving X+ drive high, driving X– drive to ground, and reading the voltage at
Y+ sense. This process is shown in Figure 5.
VDrive
VDrive
X– X+
Read X+ sense
Read Y– sense
Y–
4 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ SLAA384A – February 2008 – Revised November 2010
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
www.ti.com MSP430 Implementation
2 MSP430 Implementation
Y+
Px.a
X– X+
MSP430F2xx
Px.b
Y–
SLAA384A – February 2008 – Revised November 2010 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ 5
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
MSP430 Implementation www.ti.com
2.3 Hardware
The schematic for the demonstration hardware is shown in Figure 7. The demonstration hardware was
designed to interface to any of the Touch International (http://www.touchinternational.com/) 8-wire resistive
touch screens (TI-8 Touch).
Figure 7. Schematic
6 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ SLAA384A – February 2008 – Revised November 2010
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
www.ti.com MSP430 Implementation
2.4 Software
The software flow charts for the 4-wire and 8-wire software are shown in Figure 8.
Yes Yes
Transmit Transmit
Read second Coordinates Read second Coordinates
X and Y X and Y
coordinates coordinates
Yes Yes
Configure pins to
Read y coordinate
read y coordinate
SLAA384A – February 2008 – Revised November 2010 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ 7
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
MSP430 Implementation www.ti.com
8 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ SLAA384A – February 2008 – Revised November 2010
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
www.ti.com Demonstration System
3 Demonstration System
To demonstrate the hardware and software solution proposed in this document, a PC application is
provided in the accompanying zip file. This section discusses how to setup and run the demonstration.
To enable RS232 communication on the board, five jumpers must be put in place as shown by the red
boxes in Figure 10. There should be no jumpers connected on the I2CEN header.
The touch screen should be connected to the TS header, and an RS232 cable should be connected
between the PC COM1 port and the RS232 connector on the board. Finally, the board should be powered
by 1.8 V to 3.6 V, either through the JTAG header or by a CR2032 battery on the back of the board.
SLAA384A – February 2008 – Revised November 2010 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ 9
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
References www.ti.com
3.2 PC Software
The PC application is provided in the associated zip file. Run setup.exe to install the software. The setup
program may download and install additional components required by the software. Once the proper
software is loaded on the board and the hardware is configured as previously described, launch the PC
software that was just installed called Touch-Screen Reader. A window similar to the one shown in
Figure 11 appears.
The PC software opens COM1 and a connection to the board. As you touch the touch screen, the
software draws the points you touch, and the coordinate of the last point are displayed in the text box at
the bottom of the application. The Clear Display button at the bottom of the application clears the previous
points drawn in the window.
4 References
1. MSP430x20x1, MSP430x20x2, MSP430x20x3 data sheet (SLAS491)
2. MSP430x2xx Family User’s Guide (SLAU144)
3. Implementing a UART Function With Timer_A3 (SLAA078)
10 4-Wire and 8-Wire Resistive Touch-Screen Controller Using the MSP430™ SLAA384A – February 2008 – Revised November 2010
Submit Documentation Feedback
© 2008–2010, Texas Instruments Incorporated
www.ti.com Revision History
Revision History
NOTE: Page numbers for previous revisions may differ from page numbers in the current version.
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DLP® Products www.dlp.com Communications and www.ti.com/communications
Telecom
DSP dsp.ti.com Computers and www.ti.com/computers
Peripherals
Clocks and Timers www.ti.com/clocks Consumer Electronics www.ti.com/consumer-apps
Interface interface.ti.com Energy www.ti.com/energy
Logic logic.ti.com Industrial www.ti.com/industrial
Power Mgmt power.ti.com Medical www.ti.com/medical
Microcontrollers microcontroller.ti.com Security www.ti.com/security
RFID www.ti-rfid.com Space, Avionics & www.ti.com/space-avionics-defense
Defense
RF/IF and ZigBee® Solutions www.ti.com/lprf Video and Imaging www.ti.com/video
Wireless www.ti.com/wireless-apps
Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2010, Texas Instruments Incorporated