# ModbusValue

## `ModbusValue` (FB)

`FUNCTION_BLOCK` ModbusValue

### **Darstellung**

<figure><img src="/files/a6AcA4O98b4SBJq61EHF" 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 registern, 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 excange (<code>Modbus\_Read</code>,<br><code>Modbus\_Write</code> or <code>Modbus\_Bidir</code>)</p>                  |
| Input  | `eModRcvOpMode`       | MODRCV\_OPERATION\_CODE |                                      | <p>Operation Mode regarding to communication erros concerning<br>Modbus-Receive-Telegrams</p>                                                  |
| Input  | `wNumberOfCoils`      | `WORD`                  | 0                                    | Number of Coils / Inputs (nur für FC01 und 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 ready successfully 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`                  |                                      | Aktion für den Modbus-Kommunikations-Fehlerzähler des Geräts                                                                                   |


---

# 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://support.powerio.com/hub/codesys-hvac/hvac-modbus-library/functionblocks/generic/modbusvalue.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.
