ModbusValue

ModbusValue (FB)

FUNCTION_BLOCK ModbusValue

InOut:

Scope
Name
Type
Initial
Comment

Input

xEn

BOOL

FALSE

Enables/Disables the function block ( TRUE = Enable )

Input

Value

__SYSTEM.AnyType

The value to read/write. It can be any IEC data type such as BOOL, WORD, INT, FLOAT…

Input

byUnitId

BYTE

1

In case of Modbus-RTU enter the slave ID. In case of Modbus- TCP or Modbus-UDP the unit is required

Input

byFunctionCode

BYTE

3

The modbus function code (3 = read input registers, 4 = read holding registers…)

Input

wRegisterAddress

WORD

The modbus register address (zero based)

Input

eReadWriteType

Modbus_ReadWrite

Modbus_Read

The direction of data exchange (Modbus_Read, Modbus_Write or Modbus_Bidir)

Input

eModRcvOpMode

MODRCV_OPERATION_CODE

Operation mode regarding communication errors concerning Modbus-Receive-Telegrams

Input

wNumberOfCoils

WORD

0

Number of Coils / Inputs ( only for FC01 and FC02 )

Inout

ModbusClient

ModbusClientBase

Instance of ModbusClient (ModbusClient_RTU, ModbusClient_TCP, ModbusClient_RTU, …)

Output

eError

ModbusErrorCode

ModbusErrorCode.NO_ERROR

Current error code (0 = NO_ERROR if data exchange succeeded)

Output

xBusy

BOOL

TRUE during data exchange

Output

xChanged

BOOL

TRUE after data was successfully ready at the Value input (only for one cycle). Use this output for any needed byte manipulations

Output

eResponseState

Response_State_Code

Response_State_Code.STATE_INVALID

Output

wModRcvActDevErrCnt

WORD

Action for the device's Modbus communication error counter

Last updated