> For the complete documentation index, see [llms.txt](https://docs.tricloudnexus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tricloudnexus.io/management-portal/designer/assets/tags/collect/configuration/modbus-tcp.md).

# Modbus TCP/RTU

This page describes how to configure a **Tag** that reads from or writes to an **Modbus TCP** or **RTU** server.

Once the Modbus Data Connector is configured on an Area, all descendant Assets can use it when defining Tags.

Modbus data collection supports only **Periodic** (polled) modes, but Tags can also be configured for **Write** operations.

### Tag Configuration

The Tag must be configured such that the Data Connection uses a Data Connector that is of either type Modbus TCP or Modbus RTU. In the example below, the data connector is called ModBusTcpServer.

<figure><img src="/files/3pMjqZ2Q1XdjErYGf2lD" alt=""><figcaption><p>Tag configuration for a Tag collecting data from a Modbus TCP server.</p></figcaption></figure>

Addressing in Modbus is similar whether it is reads or writes.

Modbus addressing is composed of fields, that must use the following format:

`adr='`**`address`**`';unit='`**`unit id`**`';datatype='`**`data type`**`';blockid='`**`block id`**`'`

Due to the complexity in configuring a Modbus address, a Modbus reference editor helps generating valid addresses. Click the blue button located to the right of the address field, to open the editor:

<figure><img src="/files/B43AxJLhdZMnQAMDfnCU" alt=""><figcaption><p>Reference editor to configure Modbus tag addresses</p></figcaption></figure>

Set the values according to the desired configuration:

* **Register**: Registers are addressable memory locations in a Modbus device that expose bits or 16/32-bit words for reading and/or writing. Possible selections are:
  * **Coils:** 1-bit **read/write** bits with address range: 00000–09999.
  * **Discrete Inputs:** 1-bit **read-only** status bits with address range: 10000–19999.
  * **Holding Registers:** 16-bit **read/write** words with address range: 40000–49999.
  * **Input Registers:** 16-bit **read-only** words address range: 30000–39999.
* **Address**: The specific register address of the data point. The field is automatically changed to fit the range of the selected register.
  * Words: Addressed by xxxxx
  * Bits: Addressed by xxxxx.b where b is the bit index in the word
* **Data Type**: The data type is limited by the type of register selected, where discrete registers does not allow for 16 or 32-bit data types. The possible data types are:
  * **uint16** for Unsigned 16-bit Integer
  * **int16** for Signed 16-bit Integer
  * **uint32** for Unsigned 32-bit Integer
  * **int32** for Signed 32-bit Integer
  * **float32** for 32-bit Floating Point
  * **bit** for a Boolean value (requires bit index set for read address)

#### Advanced settings

**Advanced Settings** let you fine-tune how the Modbus connector targets devices and optimizes I/O. Most deployments work with defaults, but when you have multiple slaves (e.g., behind a TCP-to-RTU gateway) or want higher throughput, adjust these options.

**Unit (Slave ID):** Sets the target device address on the bus. For Modbus RTU, valid IDs are typically **1–247** (most devices default to **1**). For Modbus TCP, the **Unit Identifier** is often **1** as well, unless a TCP-to-serial gateway routes to multiple downstream slaves—then set it to the specific RTU slave you intend to reach.

**Block Read:** Enables bulk reads of **contiguous** addresses in a single request (e.g., many holding/input registers with one call). This reduces round-trips, lowers device load, and improves throughput.

{% hint style="info" %}
Use block reads, to reduce roundtrips and load, when your tags are mapped to adjacent addresses of the same register class. Group tags to contiguous ranges and keep separate blocks per register class (coils vs. registers).
{% endhint %}

**Block Read Operation Id**: Assign a numeric id to group this tag with others for a single bulk read. The connector processes blocks ordered by the id. Within each block, addresses are read **from the lowest to the highest**. Use the same block operation id to coalesce contiguous tags into one operation.

{% hint style="danger" %}
When planning a block read, make sure to carefully set the appropriate addresses.

Each individual block read will be executed starting at the lowest address, reading all bytes until the highest address. If the address span is large timeouts might occur.
{% endhint %}
