??? 11/29/11 16:57 Read: times Msg Score: +1 +1 Informative |
#184940 - re: Resistive touch screen Responding to: ???'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! Mahmood 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? -a |
Topic | Author | Date |
Resistive touch screen | 01/01/70 00:00 | |
Good for you! | 01/01/70 00:00 | |
re: Resistive touch screen | 01/01/70 00:00 | |
Thanks | 01/01/70 00:00 | |
re: Thanks | 01/01/70 00:00 | |
GND reference | 01/01/70 00:00 | |
Hardware or software | 01/01/70 00:00 | |
re: Hardware or software | 01/01/70 00:00 | |
oh, you do | 01/01/70 00:00 | |
analog in instead of open drain | 01/01/70 00:00 | |
re: analog in .. | 01/01/70 00:00 | |
tough to love :) | 01/01/70 00:00 | |
software | 01/01/70 00:00 | |
When I did Touch Screen Stuff | 01/01/70 00:00 | |
GUI | 01/01/70 00:00 | |
If you have ... | 01/01/70 00:00 | |
Article | 01/01/70 00:00 | |
Let Chinese do that | 01/01/70 00:00 |