# SimpleWriteValueCoil

## `SimpleWriteValueCoil` (FB)

`FUNCTION_BLOCK` SimpleWriteValueCoil

### Representation

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

### Use of type conversion operators (e.g. REAL\_TO\_WORD) directly at the input `InputValue`

In this configuration, compiler error messages of type C0032 are generated; a download is not possible.

{% hint style="info" %}
Remedy:

Use of an intermediate variable of the explicit type `WORD` directly at the output of the type conversion operator. Connection of the intermediate variable at the input `InputValue`.
{% endhint %}

### Codesys

InOut:

| Scope       | Name              | Type                              | Initial                                      | Comment                                                                                                                                              |
| ----------- | ----------------- | --------------------------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| Input       | `xEn`             | `BOOL`                            | TRUE                                         | Enable / disable communication (TRUE = enable)                                                                                                       |
| Input       | `byUnitId`        | `BYTE`                            | 0                                            | Device address                                                                                                                                       |
| Input       | `InputValue`      | `__SYSTEM.AnyType`                |                                              | Input variable for determining the states of the coils (FC05, FC15) (`BYTE`, `WORD`, `DWORD`, `LWORD`)                                               |
| Input       | `xUpdateSetp`     | `BOOL`                            | FALSE                                        | Update of setpoints (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` | WriteFunctionCodesCoil            |                                              | Feedback - Modbus function code for the Modbus telegram                                                                                              |
| Output      | `wCoilAddrFb`     | `WORD`                            |                                              | <p>Feedback - starting address of the coil for the Modbus-<br>telegram</p>                                                                           |
| Output      | `xAlarm`          | `BOOL`                            |                                              | Collective fault (TRUE = fault)                                                                                                                      |
| Output      | `xAlarmCom`       | `BOOL`                            |                                              | Collective fault - communication (TRUE = fault)                                                                                                      |
| Output      | `eErrorCodeCom`   | ModbusErrorCode                   |                                              | Error code - communication (0 = no error)                                                                                                            |
| Output      | `eErrorCodeDev`   | SIMPLE\_WRITE\_VALUE\_ERROR\_CODE |                                              | Error code - device (0 = no error)                                                                                                                   |
| Output      | `xBusy`           | `BOOL`                            |                                              | Communication display (TRUE = communication)                                                                                                         |
| Input Const | `eFunctionCode`   | WriteFunctionCodesCoil            | WriteFunctionCodesCoil.FC05\_WriteSingleCoil | Modbus function code for the Modbus telegram                                                                                                         |
| Input Const | `wCoilAddr`       | `WORD`                            |                                              | Starting address of the coil for the Modbus telegram                                                                                                 |
| Input Const | `tTimeUpdateSetp` | `TIME`                            | TIME#0ms                                     | <p>Update interval for the processes influenced by the input<br><code>xUpdateSetp</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/simplewritevaluecoil.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.
