ECATCommErrors
Function Block A function block groups an algorithm and a set of private data. It has inputs and outputs. - Returns a list of bad EtherCAT ***EtherCAT is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT was to apply Ethernet to automation applications which require short data update times (also called cycle times) with low communication jitter (for synchronization purposes) and low hardware costs connections.
Inputs
Input |
Data Type |
Range |
Unit |
Default |
Description |
---|---|---|---|---|---|
Execute |
BOOL |
0, 1 |
N/A |
No default |
Read the communication errors on the rising edge A rising edge is the transition of a digital signal from low to high. It is also called positive edge. |
Connection |
ECATCommErr_ref See the ECATCommErr_ref Structure table. |
N= 0 to 2 times the number of EtherCAT devices. |
N/A |
No default |
Array of bad connections. The safe size for the list is: [ |
Outputs
Output |
Data Type |
Range |
Unit |
Description |
---|---|---|---|---|
Done |
BOOL |
No range |
N/A |
Indicates whether this function block has completed without error. |
Error |
BOOL |
No range |
N/A |
Indicates whether this function block has completed with error. |
ErrorID |
DINT |
No range |
N/A |
The function call error result, if Error is TRUE.
|
ConnectionCount |
UINT |
No range |
N/A |
The number of bad connections. Valid indices in the Connection array range from 0 (zero) to ConnectionCount -1 (assuming ConnectionCount != 0). |
Remarks
If EtherCAT network communication is shutdown, the failed connections are based on information that was taken at the time the network was shutdown.
-
- See Check the Connections for Errors for an example of implementing this function.
Figure 6-72: ECATCommErrors Function Block
ECATCommErr_ref Structure
Parameter |
Type |
Description |
---|---|---|
CommErrorCounter |
UINT |
The Communication Error Counter for this port. |
ConnectedSlaveAddress |
INT |
The EtherCAT address of the connected device. |
ConnectedSlavePortID |
UINT |
The port number of the connected device. |
LostLinkCounter |
UINT |
The Lost Link Counter for this port. |
SlaveAddress |
INT |
The EtherCAT address of the device that owns the port. |
SlavePortID |
UINT |
The port number. |
EtherCAT Port Numbers Defines
Define |
Port |
---|---|
#define EC_PORT_A |
0 (* Port A *) |
#define EC_PORT_B |
1 (* Port B *) |
#define EC_PORT_C |
2 (* Port C *) |
#define EC_PORT_D |
3 (* Port D*) |
Possible Error Codes and Descriptions
Error Code |
Description |
---|---|
The EtherCAT driver is in a bad state. |
|
The size of the Connections is too small. |
- When the array size is smaller than the number of bad connections:
- The array is filled with the data to the size of the array.
- The error ECERR_INVALID_ARRAY_SIZE is set.
- In this scenario, the output ConnectionCount is set to the size of the array and it is smaller than the number of actual bad connections.
FBD Language Example
FFLD Language Example
IL Language Example
Not available.
ST Language Example
(********************************************************)
Read EtherCAT communication errors.
(********************************************************)
commErrors( TRUE, Connection);
See Also