ECATDeviceStatus
Description
This function block provides the EtherCATEtherCAT 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 state and the port link status information for the EtherCAT device. If the EtherCAT network communication is not running due to a shutdown, the device status contains information that was taken at the time the network was shutdown. This function block is useful in locating the device(s) with communication errors when the ECATWCStatus function indicates there are EtherCAT communication errors.
Figure 7-188: ECATDeviceStatus function block
Arguments
Input
Execute |
Description |
Read the device status on the rising edgeA rising edge is the transition of a digital signal from low to high. It is also called positive edge |
Data type |
BOOL | |
Range |
0,1 | |
Unit |
N/A | |
Default |
||
SlaveAddress |
Description |
The address of the device from which data is read. The first node usually has the value '1001'. The second node usually has the value '1002'. Alternately, you can use the members of the EtherCAT structure to specify a device's address when you create the variable. |
Data type |
INT | |
Range |
- | |
Unit |
N/A | |
Default |
- |
Output
Done |
Description |
Indicates when the function is complete |
Data type |
BOOL | |
Unit |
N/A | |
State |
Description |
Indicates the EtherCAT state of the device. See State Defines below for details.
|
Data type |
UINT | |
Unit |
N/A | |
LinkStatus |
Description |
Provides the physical link status of the device's ports. See LinkStatus Defines below.
|
Data type |
UINT | |
Unit |
N/A | |
Error |
Description |
Indicates the function failed due to an error. |
Data type |
BOOL | |
Unit |
N/A | |
ErrorID |
Description |
The function call error result, if Error is TRUE (see list of Error Codes in table below). Upon success, Error is set to zero.. |
Data type |
DINT | |
Unit |
#define EC_STATE_NO_COMMUNICATION 0 (* 0x00 = No Communication to device *)
#define EC_STATE_INIT 1 (* 0x01 = Device in Init state *)
#define EC_STATE_PREOP 2 (* 0x02 = Device in Pre-operational state *)
#define EC_STATE_BOOTSTRAP 3 (* 0x03 = Device in Bootstrap state *)
#define EC_STATE_SAFEOP 4 (* 0x04 = Device in Safe-Operational state *)
#define EC_STATE_OP 8 (* 0x08 = Device in Operational state *)
#define EC_STATE_ERROR 16 (* 0x10 bit 4 set to 1; Device not in requested state error *)
#define EC_LINK_NO_COMMUNICATION 1 (* 0x1 = No communication to device; bit 0 set to 1 *)
#define EC_LINK_PORT_A 16 (* 0x10 = Link detected on Port A; bit 4 set to 1 *)
#define EC_LINK_PORT_B 32 (* 0x20 = Link detected on Port B; bit 5 set to 1 *)
#define EC_LINK_PORT_C 64 (* 0x40 = Link detected on Port C; bit 6 set to 1 *)
#define EC_LINK_PORT_D 128 (* 0x80 = Link detected on Port D; bit 7 set to 1 *)
Related Functions
ECATWCStatus, ECATMasterStatus
Example
-
- See Checking the Device (slave) States: in the EtherCAT Communication Diagnosis Steps section of the Troubleshooting chapter for an example of implementing this function.
Structured Text
(********************************************************)
(* Read AKD_1 device state and link status*)
(********************************************************)
Inst_EcDeviceStatus(TRUE,EtherCAT.AKD_1);
FBD
FFLD