Knowledge Base

In SPLat/PC the SimpleHMI provides a second screen for event tracing. This has its own hash command, HMI_Trace, with its own set of permitted hash functions. The trace window displays whatever is sent by the SPLat controller on a scrolling display, so it can provide a record of past events. The same information can also be saved to a disk file.

Run the following program in a SPLat controller to see how tracing differs from the regular SimpleHMI screen. The trace screen is made visible by the Show Trace button in the lower righthand corner of the SimpleHMI screen. You can write the trace data to disk as it comes in; select the Settings tab to set the trace file name.

Trace is designed specifically to assist in debugging. There is also a data logging feature that exists in the Android version as well.

(Click here for some tips for working around problems with copy and paste out of Internet Explorer and HTML-help (.chm) files)

;=============== Demonstrating the trace screen in SimpleHMI =======================
;Demonstrating the trace screen in SimpleHMI in SPLat/PC
fTimer defFLOAT
hTimer defByte
# HMI_Trace TraceOn() ;Enable trace output
# Open_Serial User(38400,8,N) ;Initialise the serial port
# HMI ConnectEvent(SimpleHMI_Init)
GoSub SimpleHMI_Init
LaunchTask TimeTickFloat
LaunchTask TimeTickHex
RunTasksForever

;Generate and display a floating point time counter
TimeTickFloat:
Pause 20
fRecallW fTimer
fLoadQ 0.2
fAdd
fStore fTimer
# HMI Cursor(0,5) FloatVar(fTimer,6,1)
GoTo TimeTickFloat

;Generate and display an 8-bit timer counter
TimeTickHex:
Pause 100
IncM hTimer
# HMI Cursor(0,15) HexVar(hTimer)
GoTo TimeTickHex

;Button handlers
TheFloatButton:
# HMI_Trace Print("Float Button ") FloatVar(fTimer,6,1) NL()
Return

TheHexButton:
# HMI_Trace Print("Hex Button ") HexVar(hTimer) NL()
Return

;----- (re-)initialise the SimpleHMI screen ---------------
SimpleHMI_Init:
# HMI Reset() HideAllButtons() SetBGColour(200,200,200) SetFGColour(0,0,128) Cls()
# HMI ButtonEvent(,10,9,3,20,"Click me! (Float)",TheFloatButton)
# HMI ButtonEvent(,15,9,3,20,"Click me! (Hex)",TheHexButton)
Return