I want to find...

Search

Shares

Table of Content

EthercatDevice.getODlist()

[Ethercat Device]

Description

Gets a list of objects existing in the object dictionary for such EtherCAT slave device.

Syntax

int getODlist(uint16_t *  list, uint32_t    list_size, uint32_t *  abortcode = NULL, uint32_t    timeout_us = 100000);

Parameters

  • [out] uint16_t *list
    The data buffer used to read the list of objects.
  • [in] uint32_t list_size
    The number of objects can be stored in the data buffer.
  • [out] uint32_t *abortcode
    The pointer of the variable used to store the SDO Abort Code.
  • [in] uint32_t timeout_us
    Timeout in microseconds.

Return Value

Return the number of objects in the object list. If the return value is less than 0, it indicates an error code.

Comment

This function must be called after a successful execution of EthercatMaster::begin(). This function is blocking and cannot be called within the Cyclic Callback.

Example

#include "Ethercat.h"

EthercatMaster master;
EthercatDevice_Generic slave;

uint16_t ODlist[1024];
int rc;

void setup() {
  Serial.begin(115200);

  master.begin();
  slave.attach(0, master);
  master.start(1000000);
}

void loop() {
  rc = sizeof(ODlist) / sizeof(ODlist[0]);
  rc = slave.getODlist(ODlist, rc);
  for (int i = 0; i < rc; i++) {
    Serial.print("Index ");
    Serial.println(ODlist[i]);
  }
}

Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.

Leave a Comment

Scroll to Top