# SimpleWriteCoils\_FC15

## `SimpleWriteCoils_FC15` (FB)

`FUNCTION_BLOCK` SimpleWriteCoils\_FC15

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2FgR0SRQIuc6yqqrOoLYpK%2FSimpleWriteCoils_FC15.png?alt=media&#x26;token=096a1947-ead6-44e3-9714-7c922d7cce56" alt=""><figcaption></figcaption></figure>

### **Transmission of the states of one or more coils (FC15) (1 - 64 coils) to an address range (range: wCoilAddr … (wCoilAddr + wNumberOfCoils - 1))**

### 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 (FC15) (`BOOL`, `BYTE`, `ARRAY` `OF` `BOOL`, `ARRAY` `OF` `BYTE`)                                                                                                                            |
| 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      | `wCoilAddrFb`                | `WORD`                                  | 0                                                    | <p>Feedback - start address of the coil(s) for the Modbus-<br>telegram (0 - 65535)</p>                                                                                                                                                              |
| Output      | `wNumberOfCoilsFb`           | `WORD`                                  | 0                                                    | <p>Feedback - number of coils to be written (range: 1<br>- 64, wNumberOfCoils <= InputValue.diSize)</p>                                                                                                                                             |
| Output      | `wArrayStartIndexFb`         | `WORD`                                  | 0                                                    | <p>Feedback - relative array element with the first coil to be<br>written (0 - (InputValue.diSize-1)) (only for the<br>data type <code>ARRAY</code> <code>OF</code> <code>BOOL</code> and <code>ARRAY</code> <code>OF</code> <code>BYTE</code>)</p> |
| Output      | `eInputValueDataType`        | SIMPLE\_WRITE\_COILS\_FC15\_DATA\_TYPE  | SIMPLE\_WRITE\_COILS\_FC15\_DATA\_TYPE.INVALID\_TYPE | <p>Internal classification of the data type of the variable with the<br>states of the coils (0 = invalid, 1 = <code>BOOL</code>, 2 = <code>BYTE</code>, 3 =<br><code>ARRAY</code>)</p>                                                              |
| Output      | `xInputValueValid`           | `BOOL`                                  | FALSE                                                | <p>Validity of the variable at the input <code>InputValue</code> (FALSE =<br>invalid, TRUE = valid)</p>                                                                                                                                             |
| Output      | `xErrorFreeDataTransmission` | `BOOL`                                  | FALSE                                                | <p>Status of the data transmission (FALSE = faulty, LH-<br>transition = error-free)</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\_WRITE\_COILS\_FC15\_ERROR\_CODE | SIMPLE\_WRITE\_COILS\_FC15\_ERROR\_CODE.NO\_ERROR    | Error code - device (0 = no error)                                                                                                                                                                                                                  |
| Output      | `xBusy`                      | `BOOL`                                  | FALSE                                                | Communication indicator (TRUE = communication)                                                                                                                                                                                                      |
| Input Const | `wArrayStartIndex`           | `WORD`                                  | 0                                                    | <p>Relative array element with the first coil to be written<br>(0 - (InputValue.diSize-1)) (only for the data type <code>ARRAY</code> <code>OF</code><br><code>BOOL</code> and <code>ARRAY</code> <code>OF</code> <code>BYTE</code>)</p>            |
| Input Const | `wNumberOfCoils`             | `WORD`                                  | 1                                                    | <p>Number of coils to be written (range: 1 - 64,<br>wNumberOfCoils <= InputValue.diSize)</p>                                                                                                                                                        |
| Input Const | `wCoilAddr`                  | `WORD`                                  | 1                                                    | <p>Start address of the coil(s) for the Modbus telegram (0 -<br>65535)</p>                                                                                                                                                                          |
| Input Const | `tTimeUpdateSetp`            | `TIME`                                  | TIME#0ms                                             | <p>Update interval for the processes influenced by the input<br><code>xUpdateSetp</code> influenced</p>                                                                                                                                             |
