I want to find...

Search

Shares

Table of Content

EthercatDevice.readSII()

[Ethercat Device]

Description

Read the data of SII EEPROM of a certain size which starting from the specified offset for such EtherCAT slave device.

Syntax

int readSII(uint32_t offset, void *data, size_t len, uint32_t timeout_ms = 500);

Parameters

  • [in] uint32_t offset
    The offset value of SII EEPROM for such EtherCAT slave device.
  • [in] void *data
    The data buffer for reading SII EEPROM.
  • [in] size_t len
    The size of the data buffer for reading SII EEPROM.
  • [in] uint32_t timeout_ms
    Timeout in milliseconds.

Return Value

Return an error code. If the returned value is zero, it indicates a successful execution of this function.

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;

uint8_t buffer[4];

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

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

void loop() {
  slave.readSII(0, buffer, 4);  // Read SII data
  Serial.print("Buffer: ");
  Serial.print(buffer[0], HEX);
  Serial.print(", ");
  Serial.print(buffer[1], HEX);
  Serial.print(", ");
  Serial.print(buffer[2], HEX);
  Serial.print(", ");
  Serial.println(buffer[3], HEX);
  delay(1000);
}

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

Leave a Comment

Scroll to Top