Did you find this site useful ? Please
to help www.micro-examples.com

If you need a coder or a freelance programmer, submit your project to me


TouchClock : Design your own GLCD Clock

Printer-friendly version | Forums | FAQs |

TouchClock Video Clip

 

Credits to CircuitED for his beautiful GLCD touchscreen, please visit :

http://www.circuit-ed.com/128x64-GLCD-BlWh-w-Touchscreen-P146C8.aspx

to find GLCD module and touchpanel datasheets. Thank you Warren !

DownLoad TouchClock Project 

Download TouchClock.ZIP project file for mikroC Download TouchClock.ZIP project file

Includes :

  • mikroC project files for PIC18F452, PIC18F4620, PIC18F4685
  • TouchClock C source code
  • TouchScreen C source code library
  • .HEX files for EasyPIC3 board, may work with EasyPIC4 and EasyPIC5 with only few adjustments in the C source code

How it works ?

This is how to connect the 4-wire resistive touchscreen to the PIC :

How to connect a 4-write resistive touchscreen to a PIC

This is how the library reads the X raw coordinate of a touch  :

  • X+ and X- are in high Z : RA0 and RA2 are inputs
  • Y+ is set to +5V : RA3 is output high
  • Y- is set to 0V : RA1 is output low
  • X+ voltage is read by ADC
  • Y+ is set to 0V : RA3 is output low
  • Y- is set to 5V: RA1 is output high
  • X- voltage is read by ADC and averaged with X+ value, the result is the raw X coordinate.

The same is then done to read the Y coordinate, please see TSlib.c file in .ZIP file above.

X and Y raw coordinates are then adjusted using calibration coordinates to get X and Y coordinates in pixel.

All trademarks and registered trademarks are the property of their respective owners