# SimpleReadArray

## `SimpleReadArray` (FB)

`FUNCTION_BLOCK` SimpleReadArray

### Representation

<figure><img src="/files/672948fea3bb3a298a827c56849b9249371d9f55" alt=""><figcaption></figcaption></figure>

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

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

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

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

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

Note: The data type of the array at the input `InputArray` cannot be detected and evaluated as of 07/07/2023 (CDS-43675 Compiler, AnyType: Extension for Arrays needed) In the tool tip 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 the 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            | Feedback - Modbus function code for the Modbus telegram                                                                                                                                                   |
| Output      | `wRegisterAddrFb`   | `WORD`                           | 0                                            | <p>Feedback - start address of the register for the Modbus<br>telegram</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 = not valid, TRUE = valid)</p>                                                                                  |
| Output      | `xDataValid`        | `BOOL`                           | FALSE                                        | <p>Validity of the data in the array <code>InputArray</code> (FALSE = invalid,<br>TRUE = valid)</p>                                                                                                       |
| 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 display (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 telegram                                                                                                                                                     |
| Input Const | `tTimeUpdateActual` | `TIME`                           | TIME#3s0ms                                   | <p>Update interval for the processes influenced by the input<br><code>xUpdateActual</code> influenced</p>                                                                                                 |


---

# 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/en/hvac-modbus-library/functionblocks/generic/simplereadarray.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.
