How do Touch Screens work?

Back to Embedded Systems Page

Please contact me if there is a problem with this web page (e.g., errors, or sections that are unclear).

There are many types of touch screen - we'll use the the simplest, the 4 wire resistive touch screen.   Two panes of glass with a resistive coating are separated by insulating “dots”. When you touch the screen, the two layers of glass touch each other.

To read an x-y position, we can do the following procedure:

  1. Apply +5V to one side of “layer 1” and ground to the other side. Voltage varies linearly from left to right

  2. When layers touch, the sensing layer (layer 2) becomes same voltage as layer 1 at location of touch (assuming no current flows).

  3. Switch operation of the two layers to sense location in other direction.

This is basically a voltage divider:

Case 1:

   

Case 2:

  


So, to get your touch screen working to read an x-y position, you will need to alternately set the top and bottom voltage (and read vertical position), and then set the side voltages (and read horizontal position).

Look at the data sheet (pages 81-87).  I think with port 6 that you can have a pin be a digital output and an analog input at the same time (though I haven't tried it).

If this doesn't work, you might have the ISR change the CSTARTADD bits, and reconfigure I/O, each time through.  One time through ISR would find "x" position, the next time would find "y," ...

Back to Embedded Systems Page

Please contact me if there is a problem with this web page (e.g., errors, or sections that are unclear).