ModbusRequest2 (FB)

FUNCTION_BLOCK ModbusRequest2

InOut:

Scope

Name

Type

Initial

Comment

Input

xExecute

BOOL

Rising edge: Action start

Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or aborted (xAbort), or in the event of an error. In this case, the corresponding output values (xDone, xError, iError) are present at the outputs for exactly one cycle.

xAbort

BOOL

If this input is TRUE, the action is stopped immediately and all outputs are reset to their initial values.

hComPort

RTS_IEC_HANDLE

usiSlaveAddr

USINT

Slave address, range 1..247

modbusCommand

ModbusCommand

The Modbus Command to be executed. Supports FCs for bit and word access

tResponseTimeout

TIME

Timeout for the request in ms

uiSendTimeout

UINT

100

Timeout sending request

pSendData

POINTER TO BYTE

Pointer to a buffer holding the data to be send to the Slave

pRecvData

POINTER TO BYTE

Pointer to a buffer for writing the data received from a Slave

transmission

MB_Transmission

transmission type (RTU or ASCII)

Output

xDone

BOOL

xBusy

BOOL

xError

BOOL

xAborted

BOOL

uiDataLength

BYTE

length of modbus-data received from slave (in bytes)

byModbusError

MB_ErrorCodes

MB_ErrorCodes.UNDEFINED

Specifies the current error as defined in the “MB_ErrorCodes” enumeration