# SimpleWriteArrayOfInt

## `SimpleWriteArrayOfInt` (FB)

`FUNCTION_BLOCK` SimpleWriteArrayOfInt

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2F1Lg82FMLTIVIzl6Vfg8A%2FSimpleWriteArrayOfInt.png?alt=media&#x26;token=b95ac3bc-445c-430e-97fe-647cbdcbba34" 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 `ariInputArray` connected. This is indicated by the output `xInputArrayValid` (= TRUE).

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

Note: The data type of the array at the input `ariInputArray` 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 `ariInputArray` 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       | `ariInputArray`    | `__SYSTEM.AnyType`                         |                                                      | <p>Input for the array of data to be written (FC16,<br><code>ARRAY OF INT</code> (16 bits per element))</p>                                          |
| 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      | `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 `ariInputArray`                                                                                                |
| Output      | `xInputArrayValid` | `BOOL`                                     | FALSE                                                | <p>Validity of the array at the input <code>ariInputArray</code> (data type,<br>size) (FALSE = not valid, 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\_WRITE\_ARRAY\_OF\_INT\_ERROR\_CODE | SIMPLE\_WRITE\_ARRAY\_OF\_INT\_ERROR\_CODE.NO\_ERROR | Error code - device (0 = no error)                                                                                                                   |
| Output      | `xBusy`            | `BOOL`                                     | FALSE                                                | Communication display (TRUE = communication)                                                                                                         |
| Input Const | `wRegisterAddr`    | `WORD`                                     |                                                      | Start address of the register 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>                                              |
