SimpleReadArray
SimpleReadArray (FB)
SimpleReadArray (FB)FUNCTION_BLOCK SimpleReadArray
Triggering 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 'InputArray'. This is indicated by the output 'xInputArrayValid' (= TRUE).
after an edge change on the input 'xUpdateActual' (FALSE >> TRUE) (one-time)
after the expiration of the time duration 'tTimeUpdateActual' ('tTimeUpdateActual' > 0) (cyclic)
after a change of the array at the input 'InputArray' (data type, size) (one-time)
after a change of essential parameters ('byUnitId', 'wRegisterAddr', 'eFunctionCode') (one-time)
after an edge change at the input 'xEn' (FALSE >> TRUE) (one-time)
after every cold start (one-time)
After completion of the data transfer, the result is signaled ('xDataValid' = TRUE / FALSE) and the transferred data is stored in the array 'InputArray'.
Note: As of 07.07.2023 the data type of the array at the input 'InputArray' cannot be detected and evaluated (CDS-43675 Compiler, AnyType: Extension for Arrays needed). The tooltip help for the input 'InputArray' shows the possible array data types depending on the chosen function code.
InOut:
Input
xEn
BOOL
TRUE
Enable / disable communication (TRUE = enable)
Input
byUnitId
BYTE
0
Modbus address of the device
Input
InputArray
__SYSTEM.AnyType
Input for the array (FC01/02: ARRAY OF BOOL, ARRAY OF BYTE) (FC03/04: ARRAY OF INT, ARRAY OF UINT, ARRAY OF WORD)
Input
xUpdateActual
BOOL
FALSE
Update of actual values (on every rising edge)
Input
xResError
BOOL
FALSE
Reinitialize the outputs 'eErrorCodeCom' and 'eErrorCodeDev' to the fault-free state (on every rising edge)
Inout
ModbusClient
ModbusClientBase
Client of the device
Output
eFunctionCodeFb
ReadFunctionCodes
ReadFunctionCodes.FC01_ReadCoils
Feedback - Modbus function code for the Modbus telegram
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 'InputArray' in dependence on the Modbus function code
Output
xInputArrayValid
BOOL
FALSE
Validity of the array at the input 'InputArray' (data type, size) (FALSE = not valid, TRUE = valid)
Output
xDataValid
BOOL
FALSE
Validity of the data in the array 'InputArray' (FALSE = not valid, TRUE = valid)
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_READ_ARRAY_ERROR_CODE
SIMPLE_READ_ARRAY_ERROR_CODE.NO_ERROR
Error code - device (0 = no error)
Output
xBusy
BOOL
FALSE
Communication indicator (TRUE = communication)
Input Const
eFunctionCode
ReadFunctionCodes
ReadFunctionCodes.FC03_ReadHoldingRegisters
Modbus function code for the Modbus telegram
Input Const
wRegisterAddr
WORD
Start address of the register for the Modbus telegram
Input Const
tTimeUpdateActual
TIME
TIME#3s0ms
Update interval for the operations influenced by the input ‘xUpdateActual’
Last updated

