Modbus commands are custom commands that you can setup for a Modbus device. Usually the commands are found in a Modbus specification for the device and you can insert them directly in to SAFE to use them during tests. Modbus commands can be set up for both Modbus RTU and Modbus TCP. The commands are set up in the same way for both types.
When pressing the
+ Add Command in the properties for a Modbus device the menu above appears where you can define, test and insert commands.
You have multiple options for each command but at its core you can chose the name, address and function code. If you want to learn more about
generel Modbus devices in SAFE click below.
|Commands||+ Add Command|
|Command Name||Command Address|
|Function Code||3 (Read Holding Register)|
|Register Type||16 bit uint|
Command Name is a custom name that you can give the command
Command Address is the address of the command given in either a number e.g
45, or a hex number e.g
Function Code is the commands function specified by the number. It can be set to:
1 (Read Coils) ,
2 (Read Discrete Input),
3 (Read Holding Registers),
4 (Read Input Registers),
5 (Write Single Coil),
6 (Write Single Holding Registers),
15 (Write Multiple Coils),
16 (Write Multiple Holding Registers), dependent on what the command should do.
Register Type specifies the type of the register. It is dependent on the function code. Using function code 3 which is
read holding register the register type can be specified selecting the range of bits from
8 bits to
64 bits and
the type meaning
bits are controlling every single bit individual.
Description is a custom description that you can give the command. With e.g. the range of write intputs etc.
Factor is a propertied used when converting inputs and output values, from and to real values to modbus values. It is applicable
if the register type is
float. As Modbus values not always are the same as the flow, angle value etc.
For a query a factor is multiplied with the register value after the constant property (see below) has
Query example of value mapping: y = (x + constant) * factor
Constant is a propertied used when converting inputs and output values, from and to real values to modbus values. It is applicable
if the register type is
float.As Modbus values not always are the same as the flow, angle value etc.
For a write the input value is divided by the factor property (see above) and the constant is subtracted.
Write example of value mapping: y = x / factor - constant