Académique Documents
Professionnel Documents
Culture Documents
AN2376
Author: Svyatoslav Paliy Associated Project: Yes Associated Part Family: CY8C24x94 GET FREE SAMPLES HERE Software Version: PSoC Designer 4.2 Associated Application Notes: AN2173 PSoC Application Notes Index
Introduction
Resistive-type touch screens are pressure-sensitive display overlays that are widely used for many applications. Touch screen construction is simple and operation is easy for users to understand. The construction and theoretical basis of operation are well documented in AN2173, Touch Screen Control and Calibration Four-Wire, Resistive. Figure 1. Touch Screen Connection Schematic
YP
Schematic
The schematic is very simple (see Figure 1). The touch screen is directly connected to the PSoC device ports. Resistors R1 and R2 are used as pull downs to terminate the PSoC inputs when the plates are not driven.
Measurement
Figure 2 shows how the PSoC pins are set to measure touch parameters. To measure parameters, the PSoC pin drive modes are adjusted as shown in Figure 2 and the ADC is connected to the corresponding pin. The Delta Sigma ADC User Module is used with 10-bit resolution and 64x oversampling rate. This allows all four measurements, including two dummy measurements, within 0.3 ms after changing ADC input. The first two parameters measured are the touch position X and Y coordinates. The second two parameters allow calculating the resistance of the touch zone to determine touch pressure. This allows the application to differentiate between a touch by a finger and a touch by a stylus.
XM +5V XP R1 1M 56 55 54 53 52 51 U1 Touch Scren YM 50 49 Vss Vdd 48 47 46 45 44 43 P0[6] P0[4] P0[2] P0[0] P2[6] P2[4] P2[2] P2[0] P4[6] P4[4] P4[2] P4[0] P3[6] P3[4] P3[2] P3[0] P5[6] P5[4] P5[2] P5[0] 42 41 40 39 38 37 36 35 34 33 32 31 30 29 R4 24R C1 0.1u 23 24 25 26 27 28 P7[7] P7[0] P1[0] P1[2] P1[4] P1[6]
R2 1M
1 2 3 4 5 6 7 8 9 10 11 12 13 14
P2[3] P2[1] P4[7] P4[5] P4[3] P4[1] P3[7] P3[5] P3[3] P3[1] P5[7] P5[5] P5[3] P5[1] P1[7] P1[5] P1[3] P1[1] 15 16 17 18 R3 24R
19 20 21 22
Vss D+ DVdd
CY 8C24794
[+] Feedback
AN2376
P0[7] P0[3]
P0[5]
A/D Convertor
XP
XM
P0[5]
Analog High Z
A/D Convertor
YM
P0[1]
Analog High Z
YM
P0[1]
Strong 0
X- Position Measurement
PSoC
Y- Position Measurement
PSoC
P0[7]
Current (when touched)
P0[7] P0[3]
Analog High Z
P0[3]
Strong 1 VCC
Strong 1 VCC
YP Touch Screen XP XM
YP Touch Screen
P0[5]
Strong 1
XM
P0[5]
Strong 0
A/D Convertor
Rtouch YM
P0[1]
Analog High Z
YM
P0[1]
Analog High Z
PSoC
PSoC
There are two methods of performing the touch pressure measurement. The first method requires knowing the Xplate resistance, the X-position (X) and two additional crosspanel measurements (Z1 and Z2) of the touch screen. Equation (1) calculates the touch pressure using this method.
The second method requires knowing the X- and Y-plate resistance, and both touch coordinates, but requires only one cross-panel measurement, Z1. Equation (2) calculates the touch pressure by the second method. The touch screen controller measures both Z1 and Z2 and sends both to the PC by USB. You can select the appropriate method of touch pressure calculation for your application.
Rtouch = Rx plate
X 2
ADC _ resolution
Z1 1 Z2
Equation 1
Rtouch =
Y 1 ADC _ resolution 2
Equation 2
USB
The touch screen controller sends all measured data to the PC via the USB port. The HID device class is used to simplify data transfer to the PC and to avoid writing a separate USB driver for the PC. The PSoC device sends a data packet to the PC that contains four 16-bit parameters. Table 1 shows the data packet structure.
[+] Feedback
AN2376
[+] Feedback
AN2376
[+] Feedback
AN2376
Contact:
In March of 2007, Cypress recataloged all of its Application Notes using a new documentation number and revision code. This new documentation number and revision code (001-xxxxx, beginning with rev. **), located in the footer of the document, will be used in all subsequent revisions. PSoC is a registered trademark of Cypress Semiconductor Corp. "Programmable System-on-Chip," PSoC Designer, and PSoC Express are trademarks of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners.
Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone: 408-943-2600 Fax: 408-943-4730 http://www.cypress.com/ Cypress Semiconductor Corporation, 2006-2007. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement.
[+] Feedback