EtherCATInterfaceBase

Summary

This interface provides the base class for all interface classes. It mainly provides set and get methods for 8, 16, and 32 bit long data. The get methods calculate the correct offset of the receive buffer of the „ecmasterlib“ and returns the data. The set methods also calculate the offset and write the data into the transmit buffer of „ecmasterlib“.

Configuration

EtherCATInterfaceBase_config.hpp

The following variables need to be adjustet for each new network.

  • numberOfDrives: total number of drives in the Network
  • bytesPerPDOFrameTX: number of bytes used per drive for the tx frame
  • bytesPerPDOFrameRX: number of bytes used per drive for the rx frame

Set Methods

The set mthodes check if the given offset is in range and writes the data to the ecmasterlib tx buffer.

void set8bit(uint32_t offsetInByte, uint32_t driveNumber, int8_t payload)

  • offsetInByte: offset within a PDO frame
  • driveNumber: additional offset for all drives with index > 0. (i. e. drive 3 will add an offset off 3*bytesPerPDOFrameTx)
  • payload: the data which is written to the buffer

Get Methods

The get methodes check if the given offset is in range and read from the ecmasterlib rx buffer.

uint8_t get8bit(uint32_t offsetInByte, uint32_t driveNumber)

  • offsetInByte: offset within a PDO frame
  • driveNumber: additional offset for all drives with index > 0. (i. e. drive 3 will add an offset off 3*bytesPerPDOFrameRx)