From 10.30 am to 6.00 pm
Welcome visitor you can login or create an account.
Shopping Cart
0 item(s) - INR0.00
Your shopping cart is empty!

Touch Screen 4.2" Resistive

Product Code: SEN-282
Availability: In Stock

Touch Screen

                         Touch screen or touch activated technology has been around for a few decades now, but only recently have prices dropped and the technology been (somewhat) perfected. As an input device touch screens offer a more natural interaction that humans are used to, which offers a great advantage for businesses selling to the general public over traditional keyboards and mouses.

This article will look at how to interface to a 4-wire resistive touch screen and find out the X and Y coordinates of the current point being touched. A minimal number of parts will be used to simplify the system hardware, and to focus more on the theory of how it works.

Schematic Overview

                 The schematic for this tutorial was kept as simple as possible so that the focus could remain on how the touch screen works and how we interface to it. You can see the completed schematic for this project below. The main parts in the schematic are the 16x2 LCD, 18F452 and Touch Screen.


Power Regulator

          If you follow my projects and tutorials you'll recognize this circuit. It's an extremely simple and straight forward +5v regulator circuit with bypass capacitor.

Touch Screen Connections

         6 connections are made to the 4 touch screen wires. 2 go to the Analog to Digital converter on the PIC and 4 go to PORTD pins RD0 - RD3. The PORTD pins will be used for providing a power and a ground to the 4-wire connections to the touch screen.

16x2 LCD Display

         The LCD display circuit will use a 4-bit interface with 2 line configuration enabled. PORTB will send the data bits to the LCD module and PORTD will send the command signals.

         The variable resistor (trimmer) that is extremely common throughout electronics outputs a static voltage depending on the current resistance setting. The resistive touch screen operates in a similar way. If we touch a point in the middle of the screen, it acts as if a trim-pot is set to the very middle resistance setting, thus outputing 1/2 the input voltage. The image above illustrates this effect across the entire screen.


        The comparison above works well and we could send the output signal from the touchscreen to an Analog to Digital converter and find out where the screen is being touched except that data would only be for 1 axis. The touchscreen has two axis, X and Y. The illustration above shows that we must actually get the axis data from one axis at a time and then use that information together to know the exact point on the screen that was touched. So 2 analog to digital conversions must take place, one for each axis of the screen.

The Software

  • •   The code is too long to include everything on this page, so I'll just cover the two important specifics:
  • •   LCD Update Cycle
  • •   Coordinate A/D Conversion

        The program has 4 main purposes. First it uses one A/D channel to convert the X-axis data, then a seperate A/D channel to convert the Y-axis data. Afterward, the X-axis data is converted and updated to the LCD, similarly the Y-Axis is converted and updated. Then the cycle repeats itself again.

        Each axis of the touch screen requires a similar process for testing to see if it is currently being touched and where. First the Power and Ground lines need to be turned on for the appropriate axis, all other connections should be high-impedance so as not to interfere. Then the touch screen output line should be read via the A/D converter. Do this for both X and Y axis and you have a 10-bit value signifying where the screen was touched.

Write a review

Your Name:

Your Review:

Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below: