Well, I tried in a second computer and it didn't work either. Somehow when I copy-paste the code from MCS into the editor window and press the button "Go Advanced" all the code after "TRISA =" is missing in my editor window and the window kind of freezes up. Is this some kind of bug, because I tried it in two different computers? So, I will attach the code as a txt file.

Megahertz,

I wrote a program a while back to control a 4-wire touchscreen in a 320x240 color GLCD. The program worked great. I used a PIC18F4550. The wiring that I used was

PortA.0, AN0 ---> X+
PortA.1, AN1 ---> X-
PortA.2, AN2 ---> Y+
PortA.3, AN4 ---> Y-


First, you need to "monitor" the touchscreen to find out if it has been touched. Then if it has been touched you find the coordinates for the point were the screen was touched.

Also, in this program I had a calibration routine. I displayed in the screen two crosses, one at the upper left corner and the other one at the lower right corner. The user had to touch one cross first and then the other cross to save the optimum parameters for the touchscreen.

The program is attached as a txt file. Review the program and if you have any questions let me know.

Touchscreen_Code.txt

Robert