Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

About

This example illustrates the process of configuring and utilizing Dynamic PDOs (Process Data Objects) within an EtherCAT SubDevice, leveraging the CoE (CANopen over EtherCAT) protocol. Dynamic PDOs facilitate flexible data transfer between slave and master devices, allowing for the dynamic configuration of data points and their associated attributes.

Prerequisites

The actual distribution of the examples can be found here: EtherCAT Slave Examples.

...

To conclude, we will demonstrate how to assess the behavior using TwinCAT.

Create a new PDO

In the initial step, a new PDO must be defined in the AppECS_DemoApplication_Config.h file by incorporating the object description as illustrated below:

...

Code Block
languagec
static const uint16_t s_aus1C12_Entries[] = { 0x1600, 0x1601, 0x1602};
    {
        .eCommand = OD_CREATE_SUBOBJECT,
        .pszName = NULL,
        .uCreate.tSubObject = {
            .usIndex = 0x1C12,
            .bSubindex = 3,
            .bValueInfo = ODV3_VALUE_INFO_INITIAL_VALUE,
            .bIndicationFlags = 0,
            .usDataType = ECAT_OD_DTYPE_UNSIGNED16,
            .usAccessRights = ECAT_OD_READ_ALL | ECAT_OD_WRITE_PREOP,
            .ulMaxFieldUnits = 1,
        },
        .tInitial = {&s_aus1C12_Entries[2], sizeof(s_aus1C12_Entries[2])},
    },

Add the handling of dynamic PDO

To effectively manage the changes in dynamic PDOs during runtime, the application must be enhanced with a function that notifies the stack of any alterations in the input/output size.

...

In this example, the PDO 0x1602, which has a size of 1 byte, is defined. To accommodate this new PDO, it is essential to modify the AppECS_OD_CalculatePdoOffsets() function.

Checking behaviour with TwinCAT

In order to check the result with TwinCAT, please the new ESI file to the TwinCAT ESI file folder. In the new project now activate PDO assignment.

...

The task has been successfully completed, and you are free to modify and enhance this example as you see fit, tailoring it to meet your specific requirements.

Conclusion

By implementing these steps and utilizing the features of Dynamic PDOs, you can develop adaptable and efficient EtherCAT SubDevices that respond effectively to evolving communication needs.