Function BlockECATDeviceStatusPLCopen motion iconPipe Network motion icon

Description

This function block provides the EtherCATClosedEtherCAT 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 edgeClosedA 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.
  • A value of zero indicates that there is no communication with the device and the state is unknown.
  • Bits 3:0 indicate the actual state of the Device.
  • An EC_STATE_ERROR (bit 4 set to 1) indicates the device is not in the EtherCAT Master requested State due to error conditions such as loss of communication..
 

Data type

UINT
 

Unit

N/A
LinkStatus

Description

Provides the physical link status of the device's ports. See LinkStatus Defines below.
  • If no communication is possible with the device, then bit 0 is set to '1'.
  • If a link is detected on a port (A-D), then the corresponding bit (4-7) will be set to '1'. If no link is detected then the corresponding bit will be set to '0'.
 

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

 

State Defines

#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 *)

LinkStatus Defines

#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

Structured Text

(********************************************************)
(* Read AKD_1 device state and link status*)
(********************************************************)


Inst_EcDeviceStatus(TRUE,EtherCAT.AKD_1);

FBD

FFLD

Go back to the top of the page [Top]