4.4.3. Pen reading sequence

Reading the pen position requires multiple operations:

  1. Poll PD for pen down (or use interrupt PENIRQ).

  2. Precharge Y (set /CS low).

  3. Delay 1ms (delays are required to allow the touchscreen plate voltages to stabilize to an acceptable level). To avoid wasting time in delay loops, enable a 1ms tick timer at this point to service the touchscreen driver.

  4. Read Y1 value. Precharge X.

  5. Delay 1ms.

  6. Read X1 value. Precharge Y.

  7. Delay 1ms.

  8. Read Y2 value. Precharge X.

  9. Delay 1ms.

  10. Read X2 value with power down. (XP is left charged). Set /CS high with low start bit.

  11. Delay 1ms.

  12. Check PD for pen up. If not pen up, check for large errors and average Y1, Y2 and X1, X2 values. If the pen is up, discard the readings and clear the interrupt by writing to TS_DATA.


    Always read X last to ensure correct operation of pendown detect.

  13. After the pen up is detected, the 1ms tick timer can be disabled.

Copyright © 2002 ARM Limited. All rights reserved.ARM DUI 0159B