Configure the Modbus TCP Connector
Discover and configure Modbus TCP devices, add register items, select data and byte-order settings, verify communication, and troubleshoot common errors.
The Modbus TCP Connector connects SIA Connect to PLCs, meters, controllers, gateways, and other devices that act as Modbus TCP servers. Use it to read coils and registers, write supported values, and discover Modbus devices on the local network.
This guide explains how to discover or create a Modbus TCP instance, add items manually, configure register addressing and data formats, verify communication, and resolve common errors.
Before you begin
Prepare the following information:
- The hostname or IPv4 address of the Modbus TCP server.
- The TCP port. The standard Modbus TCP port is
502. - The Modbus unit ID, also called the server ID or slave ID.
- The register type and address for each value.
- The data type, word order, and byte order used by the device.
- Confirmation that the required coils or holding registers are writable.
Make sure SIA Connect can reach the device and that firewalls allow the configured TCP port.
Writing to a Modbus device can change equipment behavior. Confirm the target address and test writes only when it is safe to change the connected process.
Discover Modbus TCP instances
The Connector can scan a selected IPv4 subnet for Modbus TCP servers. It checks the configured TCP ports and unit IDs, then requests device identification information when the server supports it.
If an enabled instance already communicates with the same server and unit ID, disable that instance before starting discovery. Some Modbus devices allow only one active TCP session.
- Open Configuration > Connectors.
- Find the installed and enabled Modbus TCP Connector.
- Start Discover instances.
- Select the network interface connected to the Modbus network.
- Enter the TCP ports and server IDs to scan.
- Set the scan duration.
- Start the discovery.
- Review the discovered candidates.
- Select the instances you want to import.
- Import the selected instances.
- Review each imported instance before enabling it.
The discovery result preconfigures the device address, TCP port, server ID, persistent connection, maximum read size, write preset, and byte-order settings. When the device supports Modbus Read Device Identification or Report Slave ID, the result can also include its vendor, product, model, and revision.
Modbus does not provide a standard way to browse process registers. The Connector supports instance discovery, but it does not support item discovery. Add process items manually using the device's register documentation.
Discovery parameters
| Parameter | Default | Accepted values | Description |
|---|---|---|---|
| Scan duration (ms) | 60000 |
1000 to 300000
|
Maximum time allowed for the complete subnet scan. |
| Network interface | eth0 |
An available interface or All IPv4 interfaces | Selects the local IPv4 network to scan. |
| TCP ports | 502 |
Ports from 1 to 65535, entered as comma-separated values or ranges |
TCP ports checked on each address. For example, enter 502,1502 or 502-510. Discovery checks a maximum of 64 ports. |
| Server IDs | 1 |
IDs from 0 to 255, entered as comma-separated values or ranges |
Modbus unit IDs checked on each server. For example, enter 1,255 or 1-10. Discovery checks a maximum of 32 IDs. If no configured ID responds, it also tries ID 255. |
A subnet scan checks a maximum of 256 host addresses per interface. Use a specific network interface and narrow port and server ID ranges to reduce scan time.
Create a Modbus TCP instance manually
- Open Workspace > Instances.
- Select Add instance.
- Select the Modbus TCP Connector.
- Enter a descriptive instance name.
- Enter the server hostname or IP address in Address.
- Complete the Connector-specific parameters described below.
- Select Save.
Instance parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
| Address | Yes | None | Hostname or IP address of the Modbus TCP server. |
| Port | Yes | 502 |
TCP port used by the server. A value of 0 is replaced with 502. |
| Server ID | Yes | 1 |
Modbus unit ID used in requests. Use the unit ID configured on the device or gateway. During normal communication, values of 0 or below are replaced with 1. |
| Persistent connection | Yes | Yes | Keeps the TCP connection open between polling cycles. Select No when the device requires SIA Connect to reconnect for each poll. |
| Max read registers | Yes | 123 |
Maximum number of registers included in one read request. Reduce this value if the device accepts smaller blocks only. |
| Write preset | Yes | Multiple registers | Selects single-value or multiple-value Modbus write requests. Single register uses function codes 5 and 6. Multiple registers uses function codes 15 and 16. |
| Endianness | Yes | Big endian | Controls the order of 16-bit words in multi-register numeric values. |
| Byte order | Yes | First byte high | Controls the order of the two bytes within each 16-bit register. |
| String endianness | Yes | Big endian | Controls the order of registers used for string values. |
| String byte order | Yes | First byte high | Controls the order of characters within each register used for a string. |
Understand word and byte order
Modbus defines 16-bit registers, but it does not define one universal register order for 32-bit and 64-bit values. Use the device documentation to select the correct settings.
| Setting | Selected value | Four-byte result |
|---|---|---|
| Endianness | Big endian | [A B] [C D] |
| Endianness | Little endian (swapped) | [C D] [A B] |
| Byte order | First byte high | [A B] [C D] |
| Byte order | First byte low (swapped) | [B A] [D C] |
The string settings apply the same choices independently to string registers.
Add a Modbus item
- Open the Modbus TCP instance.
- Open its Items section.
- Select Add item.
- Enter a descriptive item name.
- Select the required read and write direction.
- Enter the register address.
- Select the register type and data type.
- Set the floating-point precision if the item uses FLOAT or DOUBLE.
- Complete the standard item settings needed by the application.
- Select Save.
Input coils and input registers are read-only in the Modbus data model. Use Write or Read/Write only for output coils and holding registers that the target device permits you to change.
Item parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
| Register | Yes | None | Modbus reference address or zero-based offset. The expected format depends on Register type. |
| Register type | Yes | Auto | Selects automatic reference addressing, Holding Register, Input Coil, Output Coil, or Input Register. |
| Type | Yes | None | Selects how the returned register data is decoded. |
| Floating point precision | For floating-point values | 4 |
Number of decimal places returned for FLOAT and DOUBLE values. |
Choose a register address
Automatic reference addressing
Select Auto to enter a standard five-digit Modbus reference. The Connector converts the reference to its zero-based protocol offset.
| Reference range | Register area | Example |
|---|---|---|
00001 to 09999
|
Output coils |
00001 becomes output coil offset 0. |
10001 to 19999
|
Input coils |
10001 becomes input coil offset 0. |
30001 to 39999
|
Input registers |
30001 becomes input register offset 0. |
40001 and above |
Holding registers |
40001 becomes holding register offset 0. |
Explicit register type
Select a specific Register type to enter the zero-based protocol offset directly. For example, select Holding Register and enter 0 for the first holding register.
Use explicit register types for bit positions and string ranges.
Choose a data type
| Type | Size | Use |
|---|---|---|
| BIT | One coil or one selected bit | Boolean coil values or a bit within a 16-bit register. |
| INT16 | 1 register | Signed 16-bit integer. |
| UINT16 | 1 register | Unsigned 16-bit integer. |
| INT32 | 2 registers | Signed 32-bit integer. |
| UINT32 | 2 registers | Unsigned 32-bit integer. |
| INT64 | 4 registers | Signed 64-bit integer. |
| UINT64 | 4 registers | Unsigned 64-bit integer. |
| FLOAT | 2 registers | 32-bit floating-point value. |
| DOUBLE | 4 registers | 64-bit floating-point value. |
| STRING | Configured register range | UTF-8 text stored across two bytes per register. |
Address a bit within a register
To read or write one bit within a holding register:
- Select Holding Register as the register type.
- Enter the zero-based register offset followed by a period and the bit number. For example,
0.3selects bit 3 in the first holding register. - Select BIT as the data type.
The bit number must be from 0 to 15. Writing a register bit first reads the current register value, changes the selected bit, and writes the updated register value back.
A read-modify-write operation can conflict with another client or controller that changes the same register at the same time.
Address a string
Strings require a register range:
- Select Holding Register or Input Register.
- Enter an inclusive zero-based range. For example,
0-9uses 10 registers. - Select STRING as the data type.
- Set String endianness and String byte order to match the device.
Each register stores two bytes, so a 10-register range can hold up to 20 bytes. A value longer than the configured range is rejected when written.
Automatic device identity items
The Connector attempts to read device identity information when communication starts. It uses Modbus function 43/14 and falls back to function 17 when needed.
The instance includes identity items for:
- Vendor
- Product code
- Revision
- Model
If the server returns more identity objects, the Connector can also add Vendor URL, Product name, and User application. Unsupported identity values remain unavailable and do not prevent normal process-data communication.
Verify the configuration
- Confirm that the instance does not report a connection error.
- Add one Read item for a register with a known value.
- Compare the value in SIA Connect with the value shown by the device or another Modbus client.
- If a multi-register value is incorrect, adjust Endianness and Byte order.
- If the device supports writing, perform a controlled write to a confirmed writable coil or holding register.
- Read the value back and confirm that the expected change was applied.
A successful connection only confirms that the Modbus TCP server is reachable. Correct values also depend on the server ID, register area, offset, data type, and byte-order settings.
Troubleshoot the Modbus TCP Connector
| Problem or message | Likely cause | Action |
|---|---|---|
| Could not connect, Connection refused, Host is unreachable, or Timeout | The address or port is incorrect, the server is stopped, or the network blocks the connection. | Confirm the address and port. Check the device state, cabling, subnet, routing, and firewall rules. Use the Edge Portal Ping tool to test basic reachability. |
| Target device failed to respond | A TCP gateway responded, but the selected downstream unit did not. | Check the server ID and the gateway's serial-side configuration. Confirm that the downstream device is powered and connected. |
| Gateway path unavailable | The gateway cannot route the request to the selected Modbus unit. | Check the gateway configuration, server ID, downstream network, and routing path. |
| Response not from requested slave | The response contains another unit ID. | Confirm the server ID and check the gateway or server for incorrect unit-ID handling. |
| Illegal function | The device does not support the requested read or write function. | Check the register area and access direction. Try the other Write preset option if the error occurs during writing. |
| Illegal data address | The selected address does not exist, the offset basis is wrong, or a block read includes unsupported registers. | Check whether the device manual uses one-based references or zero-based offsets. Verify the register type and reduce Max read registers. Avoid item groups that span unavailable addresses. |
| Illegal data value | The value, request length, or requested operation is not accepted by the device. | Check the target data type, permitted value range, item direction, and the device's supported request size. |
| Slave device or server is busy or Acknowledge | The server has accepted the request but cannot complete it immediately. | Increase the item's polling interval and reduce concurrent traffic. Check the server load before retrying. |
| Wrong offset format | The register field does not contain a valid number or supported bit or range format. | Use a five-digit reference with Auto, or select an explicit register type and enter a zero-based offset. |
| Non-bit input type. Input or Output Coil required. | A coil read was requested with an incompatible register type. | Use Input Coil or Output Coil for a coil item. Use a register type for word-based data. |
| Bit value out of range | The bit position is outside the valid range. | Use a bit number from 0 to 15. |
| Invalid bool/bit value to write | The value is not 0 or 1. |
Convert the mapped value to 0 or 1 before writing. |
| Invalid address format for bit or Invalid address format for string | The selected data type does not match the address format. | Use a period and bit number for a register bit. Use a hyphenated register range for a string. |
| Invalid string range or String too long | The range is invalid or the text requires more than two bytes per configured register. | Correct or enlarge the register range. Confirm the available register space before writing. |
| The value is readable but incorrect | The data type, word order, byte order, address basis, or floating-point precision is wrong. | Compare the device documentation with the item and instance settings. Test the available endianness and byte-order combinations using a known value. |
| A write fails while reads work | The address is read-only, the selected write function is unsupported, or the device requires write permission or an operating mode. | Use an output coil or writable holding register. Confirm write access on the device and try the other Write preset option. |
| Discovery returns no devices | The wrong interface, port, server ID, or subnet was scanned. The server may also reject a second TCP session. | Select the connected interface, confirm the scan ranges, increase the duration, and disable an existing instance that uses the same device. Large subnets may require a narrower network configuration. |
| Discovery finds the address but no vendor or model | The device responds to Modbus but does not implement Read Device Identification or Report Slave ID. | Import the candidate and enter a descriptive name manually. Missing identity metadata does not prevent register communication. |
If the problem continues, review the instance and item errors together with the system logs. The reported Modbus exception normally identifies whether the problem concerns connectivity, the unit ID, the function, the address, or the value.