ECATWritePDOData

PLCopen motion icon Pipe Network motion icon

 Function Block - Writes data to an Output Rx PDO object of the EtherCAT device in the cyclic EtherCAT frame.

Inputs

Input

Data Type

Range

Unit

Default

Description

Enable

BOOL

FALSE, TRUE

N/A

No default

When Enable is TRUE, bytes are copied from CoEDataArray to the output Output Rx PDO object.

Index

UINT

0 to 65535

N/A

No default

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

SubIndex

USINT

0 to 255

N/A

No default

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

Size

USINT

1 to 255

BYTE

No default

The size of the CoE object to write.

  • 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

The data in this array is copied to the Output Rx PDO data.

Outputs

Output

Data Type

Range

Unit

Description

Status

BOOL

FALSE, TRUE

N/A

If TRUE, indicates data was written without error.

Error

BOOL

FALSE, TRUE

N/A

Indicates whether this function block has completed with error.

ErrorID

DINT

No range

N/A

The function block error result, if the Error is TRUE.

  • 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 CoEDataArray is copied to cyclic EtherCAT frame.
  • The EtherCAT Device and the EtherCAT Master should be in Operational State (EC_STATE_OP).
  • SerializeOut can be used to convert the value in the bytes to CoEDataArray.
    • Endianness: EtherCAT transmits the data in little endian format.

Figure 1: ECATWritePDOData

Error Codes

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

// Convert the variable to byte array.SerializeOut( rxPdoData, rxTargetTorque, 0, FALSE ); 
// Write the bytes to the cyclic etherCAT rxPDO frame.
Inst_ECATWritePDOData1( TRUE, 16#6071, 0, 4, EtherCAT.AKD_1, rxPdoData ); 
IF Inst_ECATWritePDOData1.Status THEN
   // Data write is successful. Perform next actions.
END_IF; 

See Also