# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
