Knowledge Base

SimpleHMI: Programming beyond the hash

The hash commands and function provided in support of SimpleHMI will cover most of what you would or could do with SimpleHMI. However, there may be times when you need a little bit more.

The most likely case is that you want to display text in a form not catered for by hash functions. This page will tell you what to do.

When text is sent to SimpleHMI for display, it is wrapped in a “datagram” or packet with the following content:

'01,"@","Your text",'03

The '01 (one character containing hex 01) signals the start of a command to SimpleHMI. The “@” is the command to SimpleHMI to display text. The '03 at the end signals the end of the text to display, and the end of this command to SimpleHMI.

Example:

Position the cursor at (5,10), print a label and the contents of X as a signed decimal number:

#       HMI Cursor(5,10) Print("X =")
iiPrintText 251,'01,"@" ;"Header" of a text display command to SimpleHMI
;vvvvvvvvvv
iisPrintXFW 251 ;251 is the serial port
;^^^^^^^^^^
iiPrintText 251,'03 ;SimpleHMI command terminator

Between the ;vvvvv and ;^^^^^^ markers you can have anything you like that results in characters coming out of the serial port, so long as no character code is less than '20 (which might scramble the display).