HMI430/700: Touchscreen calibration
Every touchscreen is slightly different so in order to convert a touch position to a pixel position each touchscreen is factory calibrated by SPLat. However time may alter the characteristics of the touchscreen, or the LCD may need to be replaced due to physical damage. As a result, you may find yourself needing to re-calibrate the touchscreen.
Calibration Activation
The touchscreen calibration routine is activated via a single SPx command, namely:
SPxCmd0 0,10 ;go perform cal, won't return until complete
This command will stop the SPLat application from running, so make sure the machine under control is in a safe state first. Control won't return to the SPLat application until either calibration is complete or power is cycled. When your application resumes, you'll have to fully redraw your screen.
On screen text will guide you through the calibration procedure which involves touching 5 locations (identified with a small dot) on the touch screen, sequentially, with the tip of a ball point pen or similar.
It's actually a great idea to place this code in the evConnect routine, triggered if the PowerOnTouch event occurs. In this way, you'll be able to activate the touchscreen calibration routine at power on, especially if the existing calibration values are so wrong that you can't press a button.
Calibration Check
For the sake of completeness, you may also check to determine if the touchscreen has been calibrated. This will always return TRUE since every HMI430 is factory calibrated.
SPxPoll1 0,10 ;get the touchscreen..
PushU 0 ;..cal status
GoIfT _NoCalReqd ;jump if we've been calibrated
;if we're here, the touchscreen has not been calibrated
