Projects › Projects › how to interface a resistive touch screen to lpc2148 (arm7) microcontroller › Hi Abiram,Good question. You
Good question. You asked for the logic only, while most people ask for a working code staraight away. I’m impressed. If you have the perfect logic, you can make your controller to do any task. Code is nothing but a representation of your logic, right?
Regarding your question,
The aim is to sense a touch and find its co-rdinates (X,Y) on the touch screen.
You have to connect the X and Y probs to seperate ADCs.
You must initialize the ADC in such a way that it should perform continuous digital conversion.
Now your code should do the following continuously
– read the ADC1
– read the ADC2
If there is no touch the values will be the maximum. If they are 10-bit ADC, 1023 will be the maximum value. This value will drop suddenly whenever you touch the screen. That’s how you sense a touch.
Now the location of the touch is the reading from both the ADC at that moment.
I can represent the logic as follows
step1: initialize the adc
step2: read adc1
step3: if adc1 value less than a threshold value, say 550 then go to step6, otherwise go to next step
step4: read adc2
step5: if adc2 value less than a threshold value, then go to next step, ortherwise go to step2
step6: read and store the value of adc1 as X cordinate and ADC2 as Y cordinate of the touch
Any further doubts, please ask.