ModbusClient_TCP
ModbusClient_TCP (FB)
ModbusClient_TCP (FB)FUNCTION_BLOCK ModbusClient_TCP EXTENDS ModbusClientBase
Function description
This function block provides the client functionalities in a Modbus-TCP communication. The counterpart must provide the server functionalities. In the ideal case ( = complete reception of the Modbus response telegram within one task cycle time ) a new transmission is started cyclically after T = 5 * task cycle time ( T = 50ms for a task cycle time of 10ms ). For Modbus telegrams with a lot of data and/or low transmission rates on the serial side (RS485) this duration can increase accordingly. InOut:
Output
xConnected
BOOL
TRUE if connection has been established
ModbusClientBase
Output
xLicenceValid
BOOL
TRUE if a valid licence was found
ModbusClientBase
Input
xEn
BOOL
TRUE
Input to enable / disable the function block
Input
sHostAddress
STRING
‘’
Hostname (FQDN, e.g. 'www.focus.de') or IP address of the server (e.g. '192.168.178.210') (Modbus-TCP)
Input
wPort
WORD
502
Port number of the server (Modbus-TCP) (502 is the default port)
Input
xResetLastErrors
BOOL
FALSE
Input to reset the error outputs (rising edge)
Output
byLastRequestUnitID
BYTE
0
Last request telegram: Unit ID (0 = no unit)
Output
eState
Client_TCP_StateCode
Client_TCP_StateCode.IDLE
Current state of the state machine as ENUM
Output
eResponseState
Client_TCP_Response_StateCode
Client_TCP_Response_StateCode.NO_ERROR
Last response telegram: Description of the state as ENUM
Output
byLastErrorUnitID
BYTE
0
Last error: Unit ID (0 = no unit)
Output
xError
BOOL
FALSE
Current error state (FALSE = no error, TRUE = error)
Output
eLastErrorCode
Client_TCP_ErrorCode
Client_TCP_ErrorCode.NO_ERROR
Last error: Description of the communication error as ENUM
Output
xReady
BOOL
FALSE
Current standby state (FALSE = not ready, TRUE = ready to send/receive Modbus data)
Input Const
tKeepAliveTimeout
TIME
TIME#1m20s0ms
Time between the last packet sent and the first probe ( idle mode)
Input Const
tTimeoutDeviceReceive
TIME
TIME#2s0ms
Timeout for the device communication (read)
Input Const
tTimeoutDeviceSend
TIME
TIME#2s0ms
Timeout for the device communication (send)
Input Const
tTimeoutConnect
TIME
TIME#3s0ms
Timeout for the client-server communication (resolve = name resolution & connection time)
Last updated

