Skip to main content

Function Block: ModbusTCPSlave

Library: IoDrvModbusTCP

This block is generated for each Modbus Server TCP in the device tree. This function block represents a TCP/IP connection to an individual Modbus TCP Server. The channels defined for this device are processed in the background. The inputs and outputs of this block provide status information to the user and allow the ability to confirm occurring errors (in order to continue processing). The Enable property is used to start and stop communication.

Note

The Enable property is available only when the Enable diagnosis for devices option is selected on the PLC Settings tab.

Table 17. Inputs (VAR_INPUT)

Name

Data Type

Initial Value

Description

xConfirmError

Bool

FALSE

The process is continued with a rising edge.



Table 18. Outputs (VAR_OUTPUT)

Name

Data Type

Initial Value

Description

xInitDone

Bool

FALSE

Displays the number of communication servers

xBusy

Bool

FALSE

TRUE while a request is in process

xDone

Bool

FALSE

TRUE if a request was ended successfully

xError

Bool

FALSE

TRUE if a request was ended with errors

byModbusError

MB_ErrorCodes

Specifies the current errors as defined in the enumeration MB_ErrorCodes

ComSettings

ModbusTCPCommSettings

Currently configured communication settings

xConfirmError

Bool

False

The process is continued with a rising edge.



Method: UpdateCommunicationSettings

The communication parameters can be updated only if the server is set to "Stop". The Enable property is used to stop and start the server.

Table 19. Inputs (VAR_INPUT)

Name

Data Type

Initial Value

Description

ipAdress

ARRAY [0..3] OF BYTE

IP address of the server

uiPort

UNIT

Port of the server



Table 20. Outputs (VAR_OUTPUT)

Name

Data Type

Initial Value

Description

UpdateCommunicationSettings

UDINT

Leads to an error (return value != 0) if a TCP connection exists