ModbusMasterTCP

ModbusMasterTCP (FB)

FUNCTION_BLOCK ModbusMasterTCP IMPLEMENTS IModbusConnector

InOut:

Scope
Name
Type
Initial
Comment

Input

xEnable

BOOL

TRUE

Input

xResetAuto

BOOL

Reset manual override of the connected slaves.

Input

sIPAddress

STRING(15)

'192.168.60.10'

Input Const

uiPort

UINT

502

Network port for ModbusTCP

Input Const

tConnectTimeout

TIME

TIME#5s0ms

Timeout time for establishing the connection. If the time expires a repeated reconnect occurs after the time elapses tWatchdogDisconnect.

Input Const

tReplyTimeout

TIME

TIME#1s0ms

Reply timeout for Modbus requests, this applies to all connected slaves.1

Input Const

tWatchdogDisconnect

TIME

TIME#25s0ms

Watchdog that monitors an active connection and performs a reconnect after the time elapses.

Output

xConnected

BOOL

TRUE = Connection to Modbus TCP participant established

Output

itfModbusConnector

IModbusConnector

THIS^

Output

udiConnectedSlaves

UDINT

Number of connected Modbus participants

Output

udiLastModbusRequestTime

UDINT

Modbus request transaction time in milliseconds

Output

udiNumberOfMsgSent

UDINT

Number of Modbus requests sent

Output

udiNumberOfMsgReply

UDINT

Number of Modbus requests received

Last updated