> 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/simplereadarray.md).

# SimpleReadArray

## `SimpleReadArray` (FB)

`FUNCTION_BLOCK` SimpleReadArray

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2FknNH6TsYeINHoiri981z%2FSimpleReadArray.png?alt=media&amp;token=ac3a5b01-57d1-4fd2-a420-ccd7e4daf1ce" alt=""><figcaption></figcaption></figure>

### **Triggering the transmission of Modbus data**

The data transmission is triggered if at least one of the conditions described below is met:

Prerequisite: A suitable array is present at the input `InputArray` connected. This is indicated by the output `xInputArrayValid` (= TRUE) signaled.

1. after an edge change at the input `xUpdateActual` (FALSE >> TRUE) (once)
2. after the time period has elapsed `tTimeUpdateActual` (`tTimeUpdateActual` > 0) (cyclically)
3. after a change to the array at the input `InputArray` (data type, size) (once)
4. after a change to essential parameters (`byUnitId`, `wRegisterAddr`, `eFunctionCode`) (once)
5. after an edge change at the input `xEn` (FALSE >> TRUE) (once)
6. after every cold start (once)

After completion of data transfer, the result is signaled (`xDataValid` = TRUE / FALSE) and the transferred data in the array `InputArray` stored.

Note: The data type of the array at the input `InputArray` cannot be recognized and evaluated as of 07/07/2023 (CDS-43675 Compiler, AnyType: Extension for Arrays needed) In the tooltip help for the input `InputArray` the possible array data types are displayed depending on the selected function code.

InOut:

| Scope       | Name                | Type                             | Initial                                      | Comment                                                                                                                                                                                                   |
| ----------- | ------------------- | -------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Input       | `xEn`               | `BOOL`                           | TRUE                                         | Enable / disable communication (TRUE = enable)                                                                                                                                                            |
| Input       | `byUnitId`          | `BYTE`                           | 0                                            | Modbus address of the device                                                                                                                                                                              |
| Input       | `InputArray`        | `__SYSTEM.AnyType`               |                                              | <p>Input for the array (FC01/02: <code>ARRAY OF BOOL</code>, <code>ARRAY OF</code><br><code>BYTE</code>) (FC03/04: <code>ARRAY OF INT</code>, <code>ARRAY OF UINT</code>, <code>ARRAY OF WORD</code>)</p> |
| Input       | `xUpdateActual`     | `BOOL`                           | FALSE                                        | Update of actual values (on every rising edge)                                                                                                                                                            |
| Input       | `xResError`         | `BOOL`                           | FALSE                                        | <p>Reinitialization of the outputs <code>eErrorCodeCom</code> or<br><code>eErrorCodeDev</code> to the error-free state (on every<br>rising edge)</p>                                                      |
| Inout       | `ModbusClient`      | `ModbusClientBase`               |                                              | Client of the device                                                                                                                                                                                      |
| Output      | `eFunctionCodeFb`   | ReadFunctionCodes                | ReadFunctionCodes.FC01\_ReadCoils            | Response - Modbus function code for the Modbus telegram                                                                                                                                                   |
| Output      | `wRegisterAddrFb`   | `WORD`                           | 0                                            | <p>Feedback - Start address of the register for the Modbus-<br>message</p>                                                                                                                                |
| Output      | `diInputArrayNumb`  | `DINT`                           | 0                                            | Number of array elements at the input `InputArray` depending on the Modbus function code                                                                                                                  |
| Output      | `xInputArrayValid`  | `BOOL`                           | FALSE                                        | <p>Validity of the array at the input <code>InputArray</code> (data type,<br>size) (FALSE = invalid, TRUE = valid)</p>                                                                                    |
| Output      | `xDataValid`        | `BOOL`                           | FALSE                                        | Validity of the data in the array `InputArray` (FALSE = invalid, TRUE = valid)                                                                                                                            |
| Output      | `xAlarm`            | `BOOL`                           | FALSE                                        | Collective fault (TRUE = fault)                                                                                                                                                                           |
| Output      | `xAlarmCom`         | `BOOL`                           | FALSE                                        | Collective fault - communication (TRUE = fault)                                                                                                                                                           |
| Output      | `eErrorCodeCom`     | ModbusErrorCode                  | ModbusErrorCode.NO\_ERROR                    | Error code - communication (0 = no error)                                                                                                                                                                 |
| Output      | `eErrorCodeDev`     | SIMPLE\_READ\_ARRAY\_ERROR\_CODE | SIMPLE\_READ\_ARRAY\_ERROR\_CODE.NO\_ERROR   | Error code - device (0 = no error)                                                                                                                                                                        |
| Output      | `xBusy`             | `BOOL`                           | FALSE                                        | Communication indicator (TRUE = communication)                                                                                                                                                            |
| Input Const | `eFunctionCode`     | ReadFunctionCodes                | ReadFunctionCodes.FC03\_ReadHoldingRegisters | Modbus function code for the Modbus telegram                                                                                                                                                              |
| Input Const | `wRegisterAddr`     | `WORD`                           |                                              | Start address of the register for the Modbus message                                                                                                                                                      |
| Input Const | `tTimeUpdateActual` | `TIME`                           | TIME#3s0ms                                   | <p>Update interval for the operations that are influenced by the input<br><code>xUpdateActual</code> influenced</p>                                                                                       |


---

# 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/simplereadarray.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.
