ECATReadSdoData

PLCopen motion icon Pipe Network motion icon

 Function Block - Reads data from an EtherCAT device using CANopen SDO read command.

Inputs

Input

Data Type

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

On the rising edge of Execute, an SDO read command is issued.

  • The function block only handles one SDO command at a time.
  • If Execute is toggled quickly so that another rising edge occurs before the SDO command has completed, the function block does not issue a second SDO command.

Index

INT

-32768 to +32767

N/A

No default

The object directory index of the data to be read.

See:

  • Communication SDOs.
  • Manufacturer specific SDOs.
  • Profile specific SDOs.

To read/write an SDO object with an index greater than 16#7FFF (32767), the value must be entered in this form:
any_to_int(index # in hex format).

Example: any_to_int(16#8321).

SubIndex

SINT

No range

N/A

No default

The sub-index of the object directory variable to be read.

See:

  • Communication SDOs.
  • Manufacturer specific SDOs.
  • Profile specific SDOs.

To read/write an SDO object with an index greater than 16#7FFF (32767), the value must be entered in this form:
any_to_int(index # in hex format).

Example: any_to_int(16#8321).

Size

UINT

1 to 255

N/A

No default

The size (i.e., number of bytes) of the CoE object to read.

The size should be the exact size of the CoE object not exceeding 255 bytes.

DeviceAddress

INT

-32768 to +32767

N/A

No default

The EtherCAT address of the device from which 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.
       

CoEDataArray[]

USINT

1 to 255

N/A

No default

The CoE object data being read.

The size of the array should be equal to or greater than the specified size.

The data is only set when an SDO read command has successfully completed.

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

Indicates whether this function block has completed without error.

Error

BOOL

FALSE, TRUE

N/A

Indicates whether this function block has completed with error.

ErrorID

DINT

No range

N/A

The SDO call error result, if Error is TRUE.

Remarks


  • This function block uses and reserves the EtherCAT SDO Channel.
    The SDO Channel remains reserved until the done output is TRUE.
    This FB should be called at each cycle until either the Done or Error output is TRUE.
    If it is not called at each cycle, the rest of SDO communication (e.g., the AKD GUI Views) is blocked.
    Using this FB in SFC P0 or P1 steps is not recommended because these steps are executed only once.
    If this FB is used in P0 or P1, then it must be used in an SFC N step to ensure the FB completes.

State Diagram

Figure 1: ECATReadSdoData State Diagram

Figure 2: ECATReadSdoData

EtherCAT Error Codes

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

(* Read DRV.NAME on first AKD Drive on EtherCAT network *)
Inst_ECATReadSdoData(TRUE, 16#2031, 0, 10, EtherCAT.AKD_1, DriveName );
IF Inst_ECATReadSdoData.Done OR Inst_ECATReadSdoData.Error THEN Inst_ECATReadSdoData(FALSE, 16#2031, 0, 10, EtherCAT.AKD_1, DriveName );
END_IF;

See Also