118
Operation with Modbus RTU Protocol
A separate guide is available which deals with the details of this protocol - the “
Serial Text Display – Modbus Interface
Guide
”. To gain a full understanding of the display, this document should be read in conjunction with this section.
Please note that the display operates as a slave device and cannot take the place of a master.
A Script has to be downloaded via the Command String and Graphic Data register set using the technique defined in the
Modbus Interface Guide
. The
<ES>, <TS>, <KS>
commands can also be sent using the same register set, however
it is normally much more convenient to use the Modbus registers provided for this purpose. For example, there is a
Modbus coil that can be used to start and stop a script and a Modbus status register that shows if a script is running or
not.
While the script is running it will set the “Result” Modbus input register to 16 or 32 for any BEKA commands sent
apart from the few special ones listed above.
Script Flow
A script is a sequence of BEKA commands executed in order. The script engine starts at the top of the list and works its
way to the bottom where it stops. This on its own is not very useful and some control over the flow of the script is
needed. Also there needs to be a way for the host system and the user to influence the flow. So a special group of two
letter commands has been added. In order to make the commands different from the usual BEKA commands they have
been prefixed with a
*
. These commands are for use of the script engine and are meaningless to the normal BEKA
command processor.
Script commands are processed in order one after the other. For example;
LN
WTHello
Will move down a line and write Hello on the screen. After writing the Hello, the script will stop.
LN
WTHello
ES
Will move down a line, write Hello and then restart at the top.
To develop more complex flows it is necessary to have a “GOTO” statement. It was decided that the old BASIC
mechanism of “GOTO line number” was a bit limited so the concept of a label was added to the engine. The
*GT
Label
command is therefore used. A label is any string of up to 6 characters but it is
NOT
case sensitive. A label
is defined by the
*LA
label
or
*LB
label
commands. e.g.
NS
*LAloop
LN
WTHello
*GTloop
This has the same effect as the second example above, except that the screen is cleared the first time the script is run.
The script engine allows the definition of 64 labels and because script space is limited it is often most efficient to use 1
or 2 character labels. In the above example the label “loop” appears twice and therefore occupies 8 bytes of the
available 2048. By reducing the label to a single “L” 6 bytes can be saved allowing for two extra 2 letter commands to
be added.
When processing long scripts it has been found that the
*BB
command was commonly used following a label
command. To save script space the
*LB
label
command has been introduced that performs the same function.
i.e.
*LAlabel
*LBlabel
*BB
=
(13 bytes)
(9 bytes)