06vidales.zip> download code
Carlos Vidales, "How to Calibrate Touch Screens" (Embedded Systems Programming magazine, June 2002).
Touch screens are finding their way into a variety of embedded products. Most touch-enabled devices will require a calibration routine. Here's a good one.
The program sample provided at 06vidales.zip includes three files: calibrate.c, calibrate.h, and sample.c. The hard work is done in the first. It contains two functions called setCalibrationMatrix() and getDisplayPoint(). The former implements Equations 13 through 18; the latter implements Equation 9. See the article "How to Calibrate Touch Screens" for more information.