Download presentation
Presentation is loading. Please wait.
Published byLesley Underwood Modified over 8 years ago
1
Interfacing Touch screen via lpc21xx Resistive touch screens can be a great way to enable complex user input in your projects inexpensively and with a minimum number of pins. With just four wires you can capture gestures, buttons clicks, constantly track the position of a finger or stylus, and other interesting things. Best of all... thanks to the success of current touch-enabled devices like the Nintendo DS, there is also a steady supply of inexpensive touch screens available (which is precisely why we've chosen to use the Nintendo DS touch screen as an example).
2
Operation of touch screen Resistive touch screens operate on the same principle as a simple potentiometer... you apply 3.3v and GND on opposite ends, and measure the resulting current in between the two on a third pin (using an analog to digital converter). The only difference is that rather than adjusting the resistance by turning a dial, you adjust it by touching a certain part of the screen. Like a potentiometer, the resistance varies depending on the position you touch, allowing you to accurately determine exactly where you are touching
3
Touch Screen View
4
The catch with touch screens is that you have two axis to handle (X and Y), but only 4 pins to measure with (X1, X2, Y1, Y2). You can easily measure one axis without doing anything special. You have to be a bit tricky, though, to measure both axis in software- only, as you'll see below. First, though, a quick diagram explaining how analog resistive touch screens work, and how to wire them up.
5
Reading method To read the current position on one axis, you simply need to apply 3.3V on one side, GND on the other, and measure the current on the bus running 'across' the axis you wish to check (see the diagrams and table below for an example of how to read both the X and the Y axis):
6
LPC2148 and Nintendo DS Touch Screen Connections X1 Y2 X2 Y1 To measure the position on X: 3.3V ADC GND --- To measure the position on Y: ADC 3.3V --- GND
7
PCONP register in lpc2148 Power control for peripherals (PCONP) allows you to turn the internal peripherals of the microcontroller (for example USB, analog to digital converters, etc.) on or off. The advantage of doing this is that you can save power by turning off any peripherals that you aren't using, which can make a big difference if your device is running off batteries or a similarly 'limited' power source.
8
PCONP register Bit(s) Alias* Description Value at Reset 0 -- Reserved NA 1 SCB_PCONP_PCTIM0 Timer 0 1 2 SCB_PCONP_PCTIM1 Timer 1 1 3 SCB_PCONP_PCUART0 UART 0 1 4 SCB_PCONP_PCUART1 UART 1 1 5 SCB_PCONP_PCPWM0 Pulse Width Modifier 0 1 6 -- Reserved NA 7 SCB_PCONP_PCI2C0 I²C 0 1 8 SCB_PCONP_PCSPI0 SPI 0 1 9 SCB_PCONP_PCRTC Real Time Clock 1 10 SCB_PCONP_PCSPI1 SPI 1 1 11 -- Reserved NA 12 SCB_PCONP_PCAD0 Analog to Digital Converter 0 1 13-18 -- Reserved NA 19 SCB_PCONP_PCI2C1 1²C 1 1 20 SCB_PCONP_PCAD1 Analog to Digital Converter 1 1 21-30 -- Reserved NA 31 SCB_PCONP_PUSB USB
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.