« Back to Product

Documentation

Modbus RTU/TCP

ModBus is a protocol based on RTU (serial binary) and TCP/IP packets. A connection with IP-Symcon is possible via LAN or serial gateway.

Warning

The following devices are supported by IP-Symcon:

Supported devices

Integration in IP-Symcon

First a "ModBus" instance has to be added within IP-Symcon. There are several variants that can be created:

Instance Description
ModBus Device Instance, which can map multiple addresses (coils/registers) and supports templates (7.0 and higher)
ModBus Coil. Instance which represents a single address (coil)
ModBus Address Instance which represents a single address (register)
Warning

Many templates can be found in our community: Show templates

The configuration of the parent gateway and I/O instance must then be adapted to the connected device. It must be selected via which protocol and device ID the device is addressed. The device ID is particularly important for RTU connected devices. For devices connected to TCP, this is often device ID 1.

Modbus Gateway Configuration

In order to be able to establish a connection to the device, IP address and port (default:502) must be entered in the gateway's parent I/O instance.
Further configuration (screenshot below) is as follows.

Option Description
Unit Data type of the variable of the device
Function (Read) Function according to which the values are to be read
Address (Read) Device address of the register to be read from
Function (Write) Function according to which the values are to be written
Address (Write) Device address of the register to be written to
Factor (Numeric values) The factor multiplies or divides the received value and writes it to the device variable
Length
(Strings)
If the length is greater than 0, it defines the precise number of characters (Bytes) queried. Note: 1 register = 2 characters (Bytes)
Byte order Depending on the device, the byte order must be adapted. Often this is not documented, but must be tried out. Big Endian and Little Endian (byte swap) are the common values.
Emulate status "Emulate status" means that the value of the variable is set to the new value if the write command is successful and does not depend on a read command
Interval If the interval is greater than 0, the address (read) is queried cyclically on the ModBus device and the variable of the device is updated
Modbus Device Configuration
Warning

Due to the fact that we still support 32 bit systems Int64 values are mapped as Float64.

FunctionCodes

Depending on the FunctionCode, a suitable address must also be entered. This can be taken from the table.
The table below also provides an overview of which FunctionCode is sent with which parameterization within IP-Symcon:

FunctionCode Device address Read/Write address Surname
0x01 (1) 1 - 10000 Device address - 1 Read Coils
0x05 (5) 1 - 10000 Device address - 1 Write Single Coil
0x02 (2) 10001 - 20000 Device address - 10001 Read Discrete Inputs
0x03 (3) 40001 - 50000 Device address - 40001 Read Holding Registers
0x10 (16) 40001 - 50000 Device address - 40001 Write Multiple registers
0x04 (4) 30001 - 40000 Device address - 30001 Read Input Registers
Warning

If, for example, address 40123 is to be written to (FunctionCode = 0x10), the appropriate data type (unit) must be selected and write address 122 (40123 - 40001) entered.

Warning

Some manufacturers do not adhere to this convention. It must be checked in the respective instructions or data sheets whether the device address must be subtracted depending on the function code or whether absolute addresses apply

Data types

Data type Sign Bits
BOOL unsigned 1
UINT8MSB unsigned 8
UINT8LSB unsigned 8
UINT16 unsigned 16
UINT32 unsigned 32
UINT64 unsigned 64
INT8MSB signed 8
INT8LSB signed 8
INT16 signed 16
INT32 signed 32
INT64 signed 64
FLOAT32 signed 32
FLOAT64 signed 64
STRING
Any questions?