# SimpleReadArray

## `SimpleReadArray` (FB)

`FUNCTION_BLOCK` SimpleReadArray

### Darstellung

<figure><img src="/files/h9M9kAEhYU7WT8v5Nsvi" alt=""><figcaption></figcaption></figure>

### **Auslösung der Übertragung von Modbus-Daten**

Die Datenübertragung wird ausgelöst, falls mindestens eine der nachfolgend beschriebenen Bedingungen erfüllt ist:

Voraussetzung: Es ist ein geeignetes Array am Eingang `InputArray` angeschlossen. Dies wird durch den Ausgang `xInputArrayValid` (= TRUE) signalisiert.

1. nach einem Flankenwechsel am Eingang `xUpdateActual` (FALSE >> TRUE) (einmalig)
2. nach Ablauf der Zeitdauer `tTimeUpdateActual` (`tTimeUpdateActual` > 0) (zyklisch)
3. nach einer Änderung des Arrays am Eingang `InputArray` (Datentyp, Grösse) (einmalig)
4. nach einer Änderung wesentlicher Parameter (`byUnitId`, `wRegisterAddr`, `eFunctionCode`) (einmalig)
5. nach einem Flankenwechsel am Eingang `xEn` (FALSE >> TRUE) (einmalig)
6. nach jedem Kaltstart (einmalig)

Nach dem Abschluss der Datenübertragung wird das Ergebnis signalisiert (`xDataValid` = TRUE / FALSE) und die übertragenen Daten im Array `InputArray` abgelegt.

Hinweis: Der Datentyp des Arrays am Eingang `InputArray` kann Stand 07.07.2023 nicht erkannt und ausgewertet werden (CDS-43675 Compiler, AnyType: Extension for Arrays needed) In der ToolTipp-Hilfe zum Eingang `InputArray` werden die möglichen Array-Datentypen in Abhängigkeit vom gewählten Function-Code angezeigt.

InOut:

| Scope       | Name                | Type                             | Initial                                      | Comment                                                                                                                                                                                                     |
| ----------- | ------------------- | -------------------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Input       | `xEn`               | `BOOL`                           | TRUE                                         | Freigabe / Sperrung der Kommunikation (TRUE = Freigabe)                                                                                                                                                     |
| Input       | `byUnitId`          | `BYTE`                           | 0                                            | Modbus-Adresse des Geräts                                                                                                                                                                                   |
| Input       | `InputArray`        | `__SYSTEM.AnyType`               |                                              | <p>Eingang für das 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                                        | Aktualisierung der Istwerte (bei jeder ansteigenden Flanke)                                                                                                                                                 |
| Input       | `xResError`         | `BOOL`                           | FALSE                                        | <p>Reinitialisierung der Ausgänge <code>eErrorCodeCom</code> bzw.<br><code>eErrorCodeDev</code> auf den fehlerfreien Zustand (bei jeder<br>ansteigenden Flanke)</p>                                         |
| Inout       | `ModbusClient`      | `ModbusClientBase`               |                                              | Client des Geräts                                                                                                                                                                                           |
| Output      | `eFunctionCodeFb`   | ReadFunctionCodes                | ReadFunctionCodes.FC01\_ReadCoils            | Rückmeldung - Modbus-Function-Code für das Modbus-Telegramm                                                                                                                                                 |
| Output      | `wRegisterAddrFb`   | `WORD`                           | 0                                            | <p>Rückmeldung - Startadresse des Registers für das Modbus-<br>Telegramm</p>                                                                                                                                |
| Output      | `diInputArrayNumb`  | `DINT`                           | 0                                            | <p>Anzahl der Arrayelemente am Eingang <code>InputArray</code> in<br>Abhängigkeit vom Modbus-Function-Code</p>                                                                                              |
| Output      | `xInputArrayValid`  | `BOOL`                           | FALSE                                        | <p>Gültigkeit des Arrays am Eingang <code>InputArray</code> (Datentyp,<br>Grösse) (FALSE = nicht gültig, TRUE = gültig)</p>                                                                                 |
| Output      | `xDataValid`        | `BOOL`                           | FALSE                                        | <p>Gültigkeit der Daten im Array <code>InputArray</code> (FALSE = nicht<br>gültig, TRUE = gültig)</p>                                                                                                       |
| Output      | `xAlarm`            | `BOOL`                           | FALSE                                        | Sammelstörung (TRUE = Störung)                                                                                                                                                                              |
| Output      | `xAlarmCom`         | `BOOL`                           | FALSE                                        | Sammelstörung - Kommunikation (TRUE = Störung)                                                                                                                                                              |
| Output      | `eErrorCodeCom`     | ModbusErrorCode                  | ModbusErrorCode.NO\_ERROR                    | Fehlercode - Kommunikation (0 = kein Fehler)                                                                                                                                                                |
| Output      | `eErrorCodeDev`     | SIMPLE\_READ\_ARRAY\_ERROR\_CODE | SIMPLE\_READ\_ARRAY\_ERROR\_CODE.NO\_ERROR   | Fehlercode - Gerät (0 = kein Fehler)                                                                                                                                                                        |
| Output      | `xBusy`             | `BOOL`                           | FALSE                                        | Kommunikationsanzeige (TRUE = Kommunikation)                                                                                                                                                                |
| Input Const | `eFunctionCode`     | ReadFunctionCodes                | ReadFunctionCodes.FC03\_ReadHoldingRegisters | Modbus-Function-Code für das Modbus-Telegramm                                                                                                                                                               |
| Input Const | `wRegisterAddr`     | `WORD`                           |                                              | Startadresse des Registers für das Modbus-Telegramm                                                                                                                                                         |
| Input Const | `tTimeUpdateActual` | `TIME`                           | TIME#3s0ms                                   | <p>Updateintervall für die Vorgänge, die durch den Eingang<br><code>xUpdateActual</code> beeinflusst werden</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/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.
