ECATReadPDOData

PLCopen motion icon Pipe Network motion icon

 Function Block - Copies the Input (Tx) PDO object data from an EtherCAT cyclic frame to a byte array.

Inputs

Input

Data Type

Range

Unit

Default

Description

Enable

BOOL

FALSE, TRUE

N/A

No default

When Enable is TRUE, bytes are copied from the Input (Tx) PDO object to CoEDataArray.

  • The PDO object is specified by its CoE Index and SubIndex.

Index

UINT

0 to 65535

N/A

No default

The CoE index of the source Input (Tx) PDO object.

SubIndex

USINT

0 to 255

N/A

No default

The CoE sub-index of the source Input (Tx) PDO object.

Size

USINT

1 to 255

BYTE

No default

The size of the CoE object to read.

  • The size should be the exact size of the CoE object.

DeviceAddress

INT

0 to 65535

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.
       

CoEDataArray[ ]

USINT[ ]

  • Dimension: >= Size.
  • Elements: No range

N/A

No default

Input (Tx) PDO data is copied to this array.

Outputs

Output

Data Type

Range

Unit

Description

Valid

BOOL

FALSE, TRUE

N/A

If TRUE, the data returned is valid.

Error

BOOL

FALSE, TRUE

N/A

If TRUE, an error has occurred.

ErrorID

DINT

No range

N/A

Indicates the error if Error output is TRUE.

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

Remarks

  • When the Enable input is TRUE, then on every cycle, the Input (Tx) PDO data is copied to the CoEDataArray.
  • The EtherCAT Device and the EtherCAT Master should be in Operational State (EC_STATE_OP).
  • SerializeIn can be used to extract the value from the CoEDataArray.
    • Endianness: EtherCAT transmits the data in little endian format.

Figure 1: ECATReadPDOData

Error Codes

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

Inst_ECATReadPDOData1( TRUE, 16#6063, 0, 4,  EtherCAT.AKD_1, txPdoData );
IF Inst_ECATReadPDOData1.Valid THEN
   // Data is valid and can be used.
   // Extract the value from the byte array. Data is in little endian format.
   SerializeIn( txPdoData, txObjValue1, 0, FALSE); END_IF;

See Also