SimpleHMI: Hash commands and functions
In the program on the previous page you will notice that virtually everything to do with the SimpleHMI is in program lines starting with a #. If this is unfamiliar to you, now is the time to read up on Hash Commands (which we originally developed for the SimpleHMI project, but will carry over to many other areas).
- The first hash line
# Open_Serial User(38400,8,N) ;Initialise the serial port
initialises the serial port to the right settings to control the SimpleHMI. This replaces the older ComSetCCB plus a Communication Control Block in NVEM. What happens is that SPLat/PC automatically generates the code and NVEM table, under the hood.
- The second hash line
# HMI ConnectEvent(HMI_Connect) ;Where to GoSub when the SimpleHMI connects
prepares the ground so that when the SimpleHMI signals that it has connected, the subroutine located at HMI_Connect will be called.
- The third hash line
# HMI Cursor(5,10) Print("Hello World") ;Display a message at row 5, column 10
is in the HMI_Connect event handler subroutine. It positions the text display cursor on the SimpleHMI, then displays a text message.
Technically the keywords Open_Serial and HMI are hash commands, while User(), ConnectEvent(), and Cursor() are hash functions.
The hash commands and functions help make the SimpleHMI very simple to program.