This function block is used to establish a connection to the specified server and makes a request for the Function Code to be executed.
Inputs:
xExecute : BOOL; Set to TRUE to execute the function block if the last execution state was FALSE.
pServer : POINTER TO T_SERVER_STRUCT; Pointer to the server to connect to.
pChannel : POINTER TO T_CHANNEL_STRUCT; Pointer to the channel to execute on the specified server.
xBlocking : BOOL; Defines if the function block is blocking or non-blocking.
Outputs:
xdone : BOOL; If TRUE the Function Code has been executed successfully.
xBusy : BOOL; The connection is in progress (preparing the request or waiting for the response).
xError : BOOL; The connection has detected an error.
udiErrorID : CLIENT_ERROR_CODES; In case or error the error code is specified.
Example in FBD:
Example in ST:
FB_ModbusConnection: MODBUS_CLIENT_CONNECTION;
IF NOT FB_ModbusConnection.xBusy THEN
IF NOT FB_ModbusConnection.xError THEN
// Read the response data
END_IF
END_IF