Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Andy Peters
11/29/11 09:57
Read: 494 times
Tucson, Az

Msg Score: +1
 +1 Informative
#184940 - re: Resistive touch screen
Responding to: Mahmood Elnasser's previous message
Mahmood Elnasser said:
I'm doing my first project using 4 wire resistive touch screen.
They are very good devices and I'm in love!

I worked out a trick/clever way of reading a resistive touchscreen with a Silicon Labs C8051F340 micro and no other parts. The trick was to realize that the particular micro can use port pins as digital I/O or as an ADC input, and the configuration can be changed on the fly. You also need to be able to use one of the pins as an interrupt. So you use four pins, one each for X+, X-, Y+ and Y-.

To detect that the screen was touched (the PENIRQ function), use the X+ pin as active-low INT0 and make sure its weak pullup is enabled. Set X+, X- and Y+ as open-drain inputs, and set Y- as a push-pull output and drive it low. When the screen is touched, X+ is pulled low and the ISR for INT0 is called.

Now that you know the screen was touched, figure out where. Configure X+ and X- as push-pull digital outputs and drive them high and low, respectively. Configure Y- as an open-drain input, which essentially disconnects it from the touchscreen, and configure Y+ as an ADC input. Start a conversion; the result tells you the X position.

Next, configure Y+ and Y- as push-pull and drive high and low respectively. Configure X- as open-drain so it is disconnected, and configure X+ as an ADC input. Convert and now you have the Y position.

Got it?


List of 18 messages in thread
Resistive touch screen      Mahmood Elnasser      11/29/11 01:41      
   Good for you!      Rob Klein      11/29/11 01:56      
   re: Resistive touch screen        Andy Peters      11/29/11 09:57      
      Thanks      Mahmood Elnasser      11/29/11 13:46      
         re: Thanks      Andy Peters      11/30/11 09:31      
      GND reference      Mahmood Elnasser      11/29/11 14:09      
         Hardware or software      Mahmood Elnasser      12/23/11 07:37      
            re: Hardware or software      Andy Peters      12/23/11 09:48      
               oh, you do      Erik Malund      12/23/11 11:51      
      analog in instead of open drain      Maarten Brock      11/29/11 15:16      
         re: analog in ..      Andy Peters      11/30/11 09:32      
   tough to love :)      Erik Malund      11/30/11 09:39      
   software      Mahmood Elnasser      12/11/11 10:47      
      When I did Touch Screen Stuff      Michael Karas      12/11/11 11:28      
         GUI      Mahmood Elnasser      12/11/11 11:54      
            If you have ...      Michael Karas      12/11/11 21:21      
               Article      Mahmood Elnasser      12/12/11 02:03      
   Let Chinese do that      JecksonS Ben      12/12/11 05:11      

Back to Subject List