> 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/hvac-modbus-library/functionblocks/generic/simplereadcoilinput.md).

# SimpleReadCoilInput

## `SimpleReadCoilInput` (FB)

`FUNCTION_BLOCK` SimpleReadCoilInput

### Darstellung

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

### Auswertung der Istwerte bei den Function-Codes 01 (Read Coils) bzw. 02 (Read Discrete Inputs)

Bei der Auswertung der Istwerte ist nur der Ausgang `arxValue` zu beachten. Es handelt sich dabei um ein Array mit 64 Elementen vom Typ `BOOL` (1 - 64 Coils / Inputs).

Die Festlegung der zu übertragenden Bits erfolgt primär durch die Wahl des Function-Codes (eFunctionCode), der Start-Adresse (wStartAddr) und der gewünschten Anzahl an Coils / Inputs (`wNumberOfCoils`) im Bereich 1 - 64.

Die Istwerte stehen wie folgt zur Verfügung:

Das erste Element `arxValue[0]` enthält den Zustand des Coils mit der Nummer `wStartAddress` Das zweite Element `arxValue[1]` enthält den Zustand des Coils mit der Nummer `wStartAddress` + 1 Das dritte Element `arxValue[2]` enthält den Zustand des Coils mit der Nummer `wStartAddress` + 2, usw. Nicht benötigte Elemente von `arxValue` werden mit FALSE beschrieben.

Aufgabe: Lese den Istwert von Coil 17

Einstellungen: eFunctionCode: ReadFunctionCodesCoilInput.FC01\_ReadCoils wStartAddr = 17 wNumberOfCoils = 1

`arxValue[0]`: Istwert von Coil 17 `arxValue[1]`: FALSE `arxValue[2]`: FALSE … `arxValue[63]`: FALSE

### CODESYS

InOut:

| Scope       | Name                | Type                                   | Initial                                      | Comment                                                                                                                                                             |
| ----------- | ------------------- | -------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Input       | `xEn`               | `BOOL`                                 | TRUE                                         | Freigabe / Sperrung der Kommunikation (TRUE = Freigabe)                                                                                                             |
| Input       | `byUnitId`          | `BYTE`                                 | 0                                            | Adresse des Geräts                                                                                                                                                  |
| 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`   | ReadFunctionCodesCoilsInputs           |                                              | Rückmeldung - Modbus-Function-Code für das Modbus-Telegramm                                                                                                         |
| Output      | `wStartAddrFb`      | `WORD`                                 |                                              | Rückmeldung - Startadresse der zu lesenden Coils/Inputs                                                                                                             |
| Output      | `wNumberOfCoilsFb`  | `WORD`                                 |                                              | Rückmeldung - Anzahl der zu lesenden Coils/Inputs (1 - 64)                                                                                                          |
| Output      | `arxValue`          | `ARRAY` \[0 .. 63] `OF` `BOOL`         |                                              | Array mit den aktuellen Coil- / Input - Zuständen                                                                                                                   |
| Output      | `xAlarm`            | `BOOL`                                 |                                              | Sammelstörung (TRUE = Störung)                                                                                                                                      |
| Output      | `xAlarmCom`         | `BOOL`                                 |                                              | Sammelstörung - Kommunikation (TRUE = Störung)                                                                                                                      |
| Output      | `eErrorCodeCom`     | ModbusErrorCode                        |                                              | Fehlercode - Kommunikation (0 = kein Fehler)                                                                                                                        |
| Output      | `eErrorCodeDev`     | SIMPLE\_READ\_COIL\_INPUT\_ERROR\_CODE |                                              | Fehlercode - Gerät (0 = kein Fehler)                                                                                                                                |
| Output      | `xBusy`             | `BOOL`                                 |                                              | Kommunikationsanzeige (TRUE = Kommunikation)                                                                                                                        |
| Input Const | `wNumberOfCoils`    | `WORD`                                 | 1                                            | Anzahl der zu lesenden Coils/Inputs (1 - 64)                                                                                                                        |
| Input Const | `eFunctionCode`     | ReadFunctionCodesCoilsInputs           | ReadFunctionCodesCoilsInputs.FC01\_ReadCoils | Modbus-Function-Code für das Modbus-Telegramm                                                                                                                       |
| Input Const | `wStartAddr`        | `WORD`                                 |                                              | Startadresse der zu lesenden Coils/Inputs                                                                                                                           |
| 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
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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
