GetConnections (FB)ΒΆ
FUNCTION_BLOCK GetConnections EXTENDS CBML.ETrig
This function block returns a snapshot from an array of Connection FBs of EtherNet/IP connections. Call the Connection FBs cyclically to get the current values.
Note
Do not call outside the buscycle task.
Note
The connection list is static on the remote adapter. In this case it is sufficient to execute this FB once. On the local adapter side the connection list is dynamic. It is necessary to periodically fetch a new snapshot to get an updated connection array.
PROGRAM PLC_PRG
VAR
ConnectionsAdapter : IoDrvEtherNetIPAdapter.CIP_Object.GetConnections;
FBConnectionsAdapter : ARRAY[0..cudiMaxConnections - 1] OF IoDrvEtherNetIPAdapter.CIP_Object.Connection;
udiNumberConnectionAdapter : UDINT;
usiTransportClass : USINT := 1;
udiCountAdapter : UDINT;
xExecute : BOOL;
END_VAR
VAR CONSTANT
cudiMaxConnections : UDINT := 10;
END_VAR
ConnectionsAdapter(xExecute := xExecute, itfCipDevice := EtherNet_IP_Adapter, usiTransportClass := usiTransportClass, udiNumberOfConnections => udiNumberConnectionAdapter, Connections := FBConnectionsAdapter);
FOR i := 0 TO cudiMaxConnections - 1 DO
IF i > udiNumberConnectionAdapter THEN
EXIT;
END_IF
FBConnectionsAdapter[i]();
END_FOR
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
xExecute
BOOL
Rising edge: Starts defined operationFALSE
: Resets the defined operation after ready condition was reachedETrig
Output
xDone
BOOL
TRUE
: Ready condition reachedETrig
xBusy
BOOL
TRUE
: Operation is runningETrig
xError
BOOL
TRUE
: Error condition reachedETrig
Input
itfCipDevice
ICIPDevice
Remote or local adapter to read connection information from.
usiTransportClass
USINT
1
The transport class of connection to be read. The default is class 1 (I/O connection).
Output
udiNumberOfConnections
UDINT
Returns the number of connections from the device. The number may differ from the size of the array of Connection FBs provided.
Input
Connections
POINTER TO Connection
Array of function blocks of connections. If the number of array instances is greater than the number of connections in the device, the remaining array instances remain null. If the number of connections in the device is greater than the array instances, the array is initialised up to the maximum instance of the array.