> For the complete documentation index, see [llms.txt](https://help.tillit.cloud/tillit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/edge/common-data-sources/modbus-tcp.md).

# Modbus TCP

## **Data Source Endpoint**

* Format: `plcIP:plcPort`
* Default port: `502`
* Example: `192.168.2.2:502`

## **Data Tag Address**

* Use the **register** location in the holding register.
* Examples: `"452"` or `"12"`

## **Modbus Options** (provided in JSON format)

Modbus also accepts the following fields as options

<figure><img src="/files/8AaGlowSJTihvVc1uikD" alt=""><figcaption></figcaption></figure>

* **scale**: Multiplies the read value for scaling. Example: `"scale": 0.0001`
* **functionCode**: Specifies the register type:
  * `3`: Input Registers
  * `4`: Holding Registers\
    Example: `"functionCode": 3`
* **bytesToRead**: Defines the number of bytes to read. Example: `"bytesToRead": 2`
* **dataType**: Converts the read data to the specified type (default is `UInt16`). Accepted types:\
  `['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64', 'float', 'double', 'utf8', 'ascii']`\
  Example: `"dataType": "int32"`
* **endianness**: Sets byte order (default is Big Endian `BE`). Options: `"BE"` or `"LE"`\
  Example: `"endianness": "BE"`
* **decimals**: Rounds floating-point values to limit decimal places (useful for precision errors).

**Example JSON Configuration**

```json
{
  "scale": 0.0001,
  "functionCode": 3,
  "bytesToRead": 2,
  "dataType": "int32",
  "endianness": "BE"
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/edge/common-data-sources/modbus-tcp.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
