---
title: "Creating a Modbus TCP Tag"
description: "Configure a Modbus register as a tag"
source_url: https://ai-ops.com/docs/tags/creating-modbus-tcp
---

# Creating a Modbus TCP Tag

After [creating a tag](https://ai-ops.com/docs/tags/creating-getting-started.md) on a Modbus TCP device, you need to tell Koios which register to read or write and how to interpret its value. You can configure these fields during creation or afterwards on the tag's **Configuration** tab.

> [!TIP] Use the register browser to discover data points
> On the Configuration tab, click **Browse** to scan registers on the device. The browser lets you read raw register values and test different data type interpretations before committing to a configuration.

## Protocol Fields

### Register Type

The type of Modbus register this tag reads from.

| Type | Description | Access |
|------|-------------|--------|
| **Coil** | Single-bit read/write registers — typically used for on/off controls | Read/Write |
| **Discrete Input** | Single-bit read-only registers — typically used for digital sensor states | Read Only |
| **Input Register** | 16-bit read-only registers — typically used for analog measurements | Read Only |
| **Holding Register** | 16-bit read/write registers — the most common type for configuration and data | Read/Write |

- **Required**

> [!NOTE] Coil and Discrete Input auto-select Boolean
> When you select **Coil** or **Discrete Input**, the data type is automatically set to **Boolean** and locked, since these register types are inherently single-bit.

### Register Address

The address of the register on the device.

- **Required**
- **Range:** 0–65535
- If the device has **one-based addressing** enabled, the display adds 1 to the address for readability, but the underlying communication always uses the 0-based value

### Data Type

How Koios interprets the raw register value(s).

| Data Type | Registers Used | Description |
|-----------|---------------|-------------|
| **Boolean** | 1 | Single bit — used with Coil/Discrete or bit extraction from a holding register |
| **Int16** | 1 | 16-bit signed integer (-32,768 to 32,767) |
| **UInt16** | 1 | 16-bit unsigned integer (0 to 65,535) |
| **Int32** | 2 | 32-bit signed integer — reads two consecutive registers |
| **UInt32** | 2 | 32-bit unsigned integer — reads two consecutive registers |
| **Float32** | 2 | 32-bit floating point — reads two consecutive registers |
| **Float64** | 4 | 64-bit floating point — reads four consecutive registers |

- **Required**
- Multi-register types (Int32, UInt32, Float32, Float64) read consecutive registers starting from the configured address

### Byte Swap

Reverses the byte order within each 16-bit register.

- **Default:** Off
- Enable this when the device stores values in a different byte order than expected — common with some manufacturers

### Word Swap

Reverses the order of registers for multi-register data types (Int32, UInt32, Float32, Float64).

- **Default:** Off
- Only visible when using a multi-register data type
- If a 32-bit value reads as a nonsensical number, try toggling this setting

> [!WARNING] Byte order varies between manufacturers
> There is no universal standard for byte and word order in Modbus. If your values look wrong (very large numbers, NaN, or values that don't match the device's display), try different combinations of byte swap and word swap until the value is correct. The register browser can help you test this.

### Bit Number

When using **Boolean** data type with an **Input Register** or **Holding Register**, this specifies which bit within the 16-bit register to extract.

- **Optional** — only shown when data type is Boolean and register type is Input or Holding
- **Range:** Bit 0 (least significant) through Bit 15 (most significant)
- Leave empty to use the entire register value as a boolean (0 = false, non-zero = true)

## Using the Register Browser

The Modbus register browser lets you scan and interpret register values directly from the device.

1. Open the tag's **Configuration** tab and click **Browse**
2. Select the **register type** and enter a **start address** and **count**
3. Click **Scan** to read raw register values from the device
4. Use the **interpretation tools** to test different data types, byte swap, and word swap combinations
5. When you find the correct interpretation, apply it to populate the tag's configuration

This is especially useful for unfamiliar devices where the register map isn't well documented.

## After Configuration

1. **Save** the tag configuration
2. **Test the tag** — click `Test` to verify Koios reads the correct value (see [Testing a Tag](https://ai-ops.com/docs/tags/troubleshooting.md#testing-a-tag))
3. **Enable the tag** — flip the enable switch to start collecting data

> [!TIP] Enable the device first
> Tags only collect data when their parent device is also enabled and running.
