MODBUS variables

Adding variables to the MODBUS master data source

MODBUS has areas in the control unit that can only be read and not written. If this is the case, a message will appear.

Then assign a name for the variable under “Name” and select the “Data type“.

You also have the option of selecting the individual areas of the controller. In this example, we have a string with the name “mosbus_master_var“.

This is located in “HoldingRegister” 10, with a “Length” of 15. Once all entries have been made, click on “Add” to create the variable.

The window remains open so that you can create further variables. Once this has been done,“Close” the window.

The variable for the MODBUS master data source has been successfully created and can now be used.


Adding variables to the MODBUS slave data source

Creating a variable for MODBUS slave data sources is done in exactly the same way as creating a variable for MODBUS master data sources.


MODBUS address syntax for quick entry

Modbus variables can also be added with a quick entry.

A variable with a single field entry can be created here using the correct syntax.

In general, the following syntax applies to Modbus addresses:

  • [Bereich][Adresse].[Datentyp]

However, if it is a string or Boolean variable, the length of the string or the position of the bit must be specified at the end:

  • [Bereich][Adresse].[Datentyp].[BitPositionOderLaenge]

If the variables are from the Coil or Input areas, the syntax is simplified as follows:

  • [Bereich][Adresse]

Areas:

AbbreviationDescription
HRHolding register
IRInstance register
CCoil
IInput

Data types:

AbbreviationDescription
X.0Boolean
I1Byte
UI1UByte
I2Short
UI2UShort
I4Integer
UI4UInteger
I8Long
UI8ULong
FFloat
DDouble
S.0String