Modbus TCP
Modbus TCP client for coils, discrete inputs, and registers.
| Property | Value |
|---|---|
| Console protocol id | modbus-tcp |
| Site Runtime plugin | modbus-tcp |
| Transport | Ethernet (TCP/UDP) |
| Read | yes |
| Write | yes — through approved writes |
| Subscribe | — |
| Default group interval | 1000 ms |
| Maturity | Production: complete driver (connection handling, address forms, batching, read and write) |
Create the device
- Open Connectivity → Devices and click Add device.
- Pick Modbus TCP in the protocol list.
- Choose the Site Runtime that can reach the device, fill the connection parameters below and click Create & connect.
- Add a group (poll interval) and tags with the address formats below. See Devices and Groups and tags for the full walk-through.
Connection parameters
Every field the Console shows for this protocol. Required fields must be set before the device can be saved.
| Parameter | Type | Default | Range / options | Required | Description |
|---|---|---|---|---|---|
Connection Modeconnection_mode | map | Client | Client, Server | yes | MakeIntelligent as the client, or as the server |
Check Headercheck_header | map | False | False, True | yes | |
Device Degradationdevice_degrade | map | False | False, True | yes | Enable or disable device degradation mechanism |
Failure Threshold for Degradationdegrade_cycle | int | 2 | 1 – 65535 | yes | The number of consecutive failure cycles required to trigger device degradation Shown when Device Degradation = True. |
Recovery Time After Degradationdegrade_time | int | 600 | 1 – 65535 | yes | The time in seconds after which the device recovers from degradation Shown when Device Degradation = True. |
Maximum Retry Timesmax_retries | int | 0 | 0 – 5 | yes | The maximum number of retries after a failed attempt to send a read command |
Retry Interval (ms)retry_interval | int | 0 | 0 – 10000 | yes | |
Enable 0x16enable16 | bool | true | — | no | Enable function 0x16 |
Endianess of 4-Byte Dataendianess | map | ABCD | ABCD, BADC, DCBA, CDAB | yes | Tag byte order, ABCD corresponds to 1234 |
Endianess of 8-Byte Dataendianess_64 | map | 12 34 56 78 | 12 34 56 78, 21 43 65 87, 87 65 43 21, 78 56 34 12 | yes | Tag byte order, applicable to int64, uint64 and double types |
Start Addressaddress_base | map | PLC Addresses (Base 1) | Protocol Addresses (Base 0), PLC Addresses (Base 1) | yes | Address starts from 1 or 0 |
Send Interval (ms)interval | int | 20 | 0 – 3000 | yes | |
IP Addresshost | string | — | — | yes | Local IP in server mode, remote device IP in client mode |
Portport | int | 502 | 1 – 65535 | yes | Local port in server mode, remote device port in client mode |
Connection Timeout (ms)timeout | int | 3000 | 1000 – 65535 | yes | |
Backup IP Addressbackup_host | string | — | — | no | Shown when Connection Mode = Client. |
Backup Portbackup_port | int | 502 | 1 – 65535 | no | Shown when Connection Mode = Client. |
Tag addresses and data types
Supported data types: INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, BIT, BOOL, STRING, BYTES. The Console validates each tag address against the pattern for its data type before it is saved:
| Data types | Address pattern (regular expression) |
|---|---|
INT16 UINT16 | ^[0-9]+![3-4][0-9]+(#B|#L|)$ |
INT32 UINT32 FLOAT | ^[0-9]+![3-4][0-9]+(#BB|#BL|#LL|#LB|)$ |
INT64 UINT64 DOUBLE | ^[0-9]+![3-4][0-9]+(#B|#L|#BB|#BL|#LL|#LB|)$ |
BIT BOOL | ^[0-9]+!([0-1][0-9]+|[3-4][0-9]+\.([0-9]|[0-1][0-5]))$ |
STRING | ^[0-9]+![3-4][0-9]+\.[0-9]+(H|L|)$ |
BYTES | ^[0-9]+![3-4][0-9]+\.[0-9]+$ |
Addressing and notes
Address syntax and examples
unit!reference holding / input register, coil, discrete input
unit!reference.bit one bit of a register (0 to 15)
unit is the Modbus unit id (0 to 255). reference is one digit for the table, then the register number: 0xxxx coil, 1xxxx discrete input, 3xxxx input register, 4xxxx holding register. With the default PLC Addresses (Base 1), 40001 is the first holding register. With Protocol Addresses (Base 0) the first one is 40000.
| Address | Type | Meaning |
|---|---|---|
1!40001 | UINT16 | Unit 1, holding register 40001 (State of the Filler in the demo plant) |
1!40003 | INT16 | Temperature in tenths of °C, use Decimal 0.1 |
1!40004 | FLOAT | Registers 40004 and 40005 (Pressure) |
1!40006 | UINT32 | Registers 40006 and 40007 (GoodCount) |
4!40004 | FLOAT | Compressor (unit 4) pressure |
1!30001 | UINT16 | Input register 30001 |
1!00001 | BOOL | Coil 1 |
1!10001 | BOOL | Discrete input 1 |
1!40001.3 | BIT | Bit 3 of holding register 40001 |
1!40020 | UINT16 | SpeedSetpoint, tick Read and Write |
A 32-bit type uses two registers and a 64-bit type four, starting at the address. A coil or discrete input can only be BOOL or BIT. The runtime merges neighbouring registers of a group into one request (at most 125 registers per request).
The tag form accepts 1!40001.10 for STRING and BYTES, but the Modbus decoder of the Site Runtime does not read these types in this version. Read the registers as integers.
Endianness
Devices disagree about the register order of 32-bit and 64-bit values. Set it for the whole device in the connection form:
| Setting | Options | Default |
|---|---|---|
| Endianess of 4-Byte Data | ABCD, BADC, DCBA, CDAB | ABCD |
| Endianess of 8-Byte Data | 12 34 56 78, 21 43 65 87, 87 65 43 21, 78 56 34 12 | 12 34 56 78 |
For one 64-bit tag you can override the order with a suffix: 1!40030#BB (12 34 56 78), #LB (21 43 65 87), #LL (87 65 43 21), #BL (78 56 34 12). The suffixes #B and #L on 16-bit tags are accepted but do not change the value. Set 32-bit order on the device, not on the tag.
Test: read a FLOAT of which you know the value (the demo plant pressure is about 3.2 bar). A huge or zero value means the order is wrong. Try CDAB next, which is the most common difference.
Typical settings
| Setting | Typical | Note |
|---|---|---|
| IP Address, Port | device IP, 502 | |
| Connection Mode | Client | Server makes MakeIntelligent wait for the device to connect. |
| Start Address | PLC Addresses (Base 1) | Check the manual of the device. |
| Connection Timeout (ms) | 3000 | 1000 to 65535. |
| Send Interval (ms) | 20 | Pause between two commands. Raise it for slow gateways. |
| Maximum Retry Times, Retry Interval (ms) | 0, 0 | Retries after a failed read (0 to 5). |
| Device Degradation | False | Turn on to slow polling of a device that keeps failing (threshold 2, recovery 600 s). |
| Backup IP Address, Backup Port | empty | A second address for a redundant device. |
Poll group interval: 1000 ms is a good start. Do not poll faster than the device answers.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
All tags bad, status Connecting | Wrong IP or port, firewall, device allows one TCP client only. | Test from the Site Runtime host. Close other masters. |
One tag bad, others good | Register does not exist on the device. | Check the register map and the start address base. |
| Value is one register off | Base 0 and base 1 mixed up. | Change Start Address. |
| FLOAT or 32-bit value is nonsense | Register order. | Change Endianess of 4-Byte Data. |
| Value 10 times too large | Raw value in tenths. | Set Decimal 0.1. |
| Wrong unit answers | Wrong unit id. | Use the unit id from the gateway's configuration. |
| "Invalid address for UINT16 (e.g. 1!40001)" | Address does not match the type. Holding and input registers are 3xxxx and 4xxxx. | Use unit!4xxxx. A coil needs BOOL or BIT. |