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.
The following devices are supported by IP-Symcon:
First a "ModBus Device" instance has to be added within IP-Symcon, which reflects a single address and, thus, value. A separate "ModBus Device" must be created for each address. Several devices (addresses) can be controlled via one gateway.
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.
Swap LSW/MSW: Some devices require that the respective 16/32-bit components are exchanged for 32/64-bit values. This option is enabled by default and can be disabled if necessary.
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.
|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 queried|
|Swap Bytes (Strings)||Swaps byte components of the queried string|
|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|
Due to the fact that PHP 5.3.x offers integers as the largest integer value, DWORDs (unsigend ints) can be read in IP-Symcon, but these are mapped to integers, which means that only the lower 31 bits can be evaluated.
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|
If, for example, address 40123 is to be written to (FunctionCode = 0x10), the appropriate unit (byte, word, DWord, ShortInt, SmallInt, Integer, Float) must be selected and write address 122 (40123 - 40001) entered.
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