> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/en/hvac-modbus-library/functionblocks/generic/modbusvalue.md).

# ModbusValue

## `ModbusValue` (FB)

`FUNCTION_BLOCK` ModbusValue

### **Representation**

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2FxRM98UThY5tMUD7lGMFN%2FModbusValue.png?alt=media&amp;token=125aa56d-14ca-4a00-8c6e-0fed0642e390" alt=""><figcaption></figcaption></figure>

InOut:

| Scope  | Name                  | Type                    | Initial                              | Comment                                                                                                                                              |
| ------ | --------------------- | ----------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Input  | `xEn`                 | `BOOL`                  | FALSE                                | Enables/Disables the function block (TRUE = Enable)                                                                                                  |
| Input  | `Value`               | `__SYSTEM.AnyType`      |                                      | <p>The value to read/write. It can be any IEC data type such as<br><code>BOOL</code>, <code>WORD</code>, <code>INT</code>, FLOAT…</p>                |
| Input  | `byUnitId`            | `BYTE`                  | 1                                    | <p>In case of Modbus-RTU enter the slave ID. In case of Modbus-<br>TCP or Modbus-UDP the unit it is required</p>                                     |
| Input  | `byFunctionCode`      | `BYTE`                  | 3                                    | <p>The modbus function code (3 = read input registers, 4 = read<br>holding registers… )</p>                                                          |
| Input  | `wRegisterAddress`    | `WORD`                  |                                      | The modbus register address (zero based)                                                                                                             |
| Input  | `eReadWriteType`      | Modbus\_ReadWrite       | Modbus\_Read                         | <p>The direction of data exchange (<code>Modbus\_Read</code>,<br><code>Modbus\_Write</code> or <code>Modbus\_Bidir</code>)</p>                       |
| Input  | `eModRcvOpMode`       | MODRCV\_OPERATION\_CODE |                                      | <p>Operation mode regarding communication errors concerning<br>Modbus receive telegrams</p>                                                          |
| Input  | `wNumberOfCoils`      | `WORD`                  | 0                                    | Number of Coils / Inputs (only for FC01 and FC02)                                                                                                    |
| Inout  | `ModbusClient`        | `ModbusClientBase`      |                                      | <p>Instance of ModbusClient (<code>ModbusClient\_RTU</code>,<br><code>ModbusClient\_TCP</code>, <code>ModbusClient\_RTU</code>, …)</p>               |
| Output | `eError`              | ModbusErrorCode         | ModbusErrorCode.NO\_ERROR            | Current error code (0 = NO\_ERROR if data exchange succeeded)                                                                                        |
| Output | `xBusy`               | `BOOL`                  |                                      | TRUE during data exchange                                                                                                                            |
| Output | `xChanged`            | `BOOL`                  |                                      | <p>TRUE after data was successfully transferred to the Value input<br>(only for one cycle). Use this output for any needed byte<br>manipulations</p> |
| Output | `eResponseState`      | Response\_State\_Code   | Response\_State\_Code.STATE\_INVALID |                                                                                                                                                      |
| Output | `wModRcvActDevErrCnt` | `WORD`                  |                                      | Action for the device's Modbus communication error counter                                                                                           |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-modbus-library/functionblocks/generic/modbusvalue.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
