# SimpleWriteArrayOfInt

## `SimpleWriteArrayOfInt` (FB)

FUNCTION\_BLOCK SimpleWriteArrayOfInt

### **Triggering of the transmission of Modbus data**

> The data transmission is triggered if at least one of the conditions described below is met:

> Prerequisite: A suitable array is connected to the input 'ariInputArray'. This is signaled by the output 'xInputArrayValid' ( = TRUE ).

> 1. after an edge change on the input 'xUpdateSetp' ( FALSE >> TRUE ) ( one-time )
> 2. after expiration of the time duration 'tTimeUpdateSetp' ( 'tTimeUpdateSetp' > 0 ) ( cyclic )
> 3. after a change of the array at the input 'ariInputArray' (data type, size, contents) (one-time)
> 4. after a change of essential parameters ( 'byUnitId', 'wRegisterAddr' ) ( one-time )
> 5. after an edge change on the input 'xEn' ( FALSE >> TRUE ) ( one-time )
> 6. after every cold start ( one-time )

> Note: The data type of the array at the input 'ariInputArray' cannot be recognized and evaluated as of 07.07.2023 (CDS-43675 compiler, AnyType: Extension for arrays needed). The possible array data types depending on the selected function code are shown in the tooltip help for the input 'ariInputArray'.

InOut:

| Scope       | Name               | Type                                       | Initial                                              | Comment                                                                                                                         |
| ----------- | ------------------ | ------------------------------------------ | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Input       | `xEn`              | `BOOL`                                     | TRUE                                                 | Enable / disable communication ( TRUE = enabled )                                                                               |
| 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>ARRAY OF INT (16 bit per element))</p>                                   |
| Input       | `xUpdateSetp`      | `BOOL`                                     | FALSE                                                | <p>Update of setpoint values (on every rising edge<br>)</p>                                                                     |
| Input       | `xResError`        | `BOOL`                                     | FALSE                                                | <p>Reinitialization of the outputs ‘eErrorCodeCom’ and<br>‘eErrorCodeDev’ 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 'ariInputArray' (data type,<br>size) (FALSE = not valid, TRUE = valid)</p>                |
| Output      | `xAlarm`           | `BOOL`                                     | FALSE                                                | General fault ( TRUE = fault )                                                                                                  |
| Output      | `xAlarmCom`        | `BOOL`                                     | FALSE                                                | General 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 indicator ( 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 operations influenced by the input<br>'xUpdateSetp'</p>                                                  |
