ModbusServer (FB)

FUNCTION_BLOCK ModbusServer

Tis function block processes up to 16 parallel client connection requests by Modbus TCP.

InOut:

Scope

Name

Type

Initial

Comment

Input

wPort

WORD

502

Modbus server port - 502 is Modbus default

pInputData

POINTER TO WORD

Input Registers

pOutputData

POINTER TO WORD

Holding Registers

uiInputDataSize

UINT

Size in words of Input Register data area

uiOutputDataSize

UINT

Size in words of Output Register data area

xEnable

BOOL

FALSE

Flag to enable execution - default is FALSE

xReset

BOOL

FALSE

Flag to reset - default is FALSE

tTimeout

UDINT

0

Modbus request timeout. If specified, the modbus data area that is updated by client (Holding Registers, Coils) is reset. Output xTimeout is TRUE.

InterfaceName

WSTRING(255)

Name of ethernet interface (optional). If specified, the modbus server binds to the IP address of this interface.

Output

xBusy

BOOL

function block is active

xError

BOOL

an Error occured

byClientConnections

BYTE

0

Number of open TCP-connections

xTimeout

BOOL

Timeout expired. Holding Registers and Coils are set to zero.