ECATDeviceStatus

PLCopen motion icon Pipe Network motion icon

 Function BlockClosed A function block groups an algorithm and a set of private data. It has inputs and outputs. - Provides the EtherCATClosed Ethernet ofr Control Automation Technology. EtherCAT® is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT is 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.

Inputs

Input

Data Type

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

Read the device status on the rising edgeClosed The transition of a digital signal from low to high. AKA: positive edge..

DeviceAddress

INT

-32768 to +32767

N/A

No default

The address of the device data is read from.

  • The first node usually has the value 1001.
  • The second node usually has the value 1002.

  • Use the members of the EtherCAT structure to specify a device's address to Create Variables.
       

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

Indicates whether this functionClosed A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. block has completed without error.

State

UINT

No range

N/A

Indicates the EtherCAT state of the device.

  • See State Defines.
  • A value of 0 (zero) indicates 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 (e.g., loss of communication).

LinkStatus

UINT

No range

N/A

Provides the physical link status of the device's ports.

  • See LinkStatus Defines.
  • If no communication is possible with the device, bit 0 is set to 1.
  • If a link is detected on a port (A-D), the corresponding bit (4-7) is set to 1.
  • If no link is detected the corresponding bit is set to 0.

Error

BOOL

FALSE, TRUE

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.

  • See Error Codes.
  • Upon success, Error is set to 0 (zero).

Remarks

  • If the EtherCAT network communication is not running due to a shutdown, the device status contains information taken at the time the network was shutdown.
  • This function block is useful in locating the devices with communication errors when the ECATWCStatus function indicates there are EtherCAT communication errors.

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

Figure 1: ECATDeviceStatus

Error Codes

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

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


Inst_EcDeviceStatus(TRUE,EtherCAT.AKD_1);

See Also