SimpleWriteArrayOfWord

SimpleWriteArrayOfWord (FB)

FUNCTION_BLOCK SimpleWriteArrayOfWord

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 'arwInputArray'. 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 'arwInputArray' ( 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: As of 07.07.2023 the data type of the array at the input 'arwInputArray' cannot be recognized and evaluated ( CDS-43675 Compiler, AnyType: Extension for Arrays needed ). The tooltip help for the input 'arwInputArray' shows the possible array data types depending on the chosen function code.

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

arwInputArray

__SYSTEM.AnyType

Input for the array of data to be written ( FC16, ARRAY OF WORD, ARRAY OF UINT ( 16 bit per element ))

Input

xUpdateSetp

BOOL

FALSE

Update of setpoint values (on every rising edge )

Input

xResError

BOOL

FALSE

Reinitialization of the outputs ‘eErrorCodeCom’ and ‘eErrorCodeDev’ to the error-free state (on every rising edge)

Inout

ModbusClient

ModbusClientBase

Client of the device

Output

wRegisterAddrFb

WORD

0

Feedback - start address of the register for the Modbus telegram

Output

diInputArrayNumb

DINT

0

Number of array elements at the input 'arwInputArray'

Output

xInputArrayValid

BOOL

FALSE

Validity of the array at the input 'arwInputArray' ( data type, size ) ( FALSE = not valid, TRUE = valid )

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_WORD_ERROR_CODE

SIMPLE_WRITE_ARRAY_OF_WORD_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

Update interval for operations influenced by the input 'xUpdateSetp'

Last updated