[Ethercat Device]
Description
Reads the entry description of the specified object addressed by index and subindex for such EtherCAT slave device.
Syntax
int getEntryDescription(uint16_t od_index, uint8_t od_subindex, uint8_t * valueinfo, uint16_t * datatype, uint16_t * bitlength, uint16_t * objaccess, char * entryname, size_t entryname_size, uint32_t * abortcode = NULL, uint32_t timeout_us = 100000);
int getEntryDescription(uint16_t od_index, uint8_t od_subindex, uint8_t & valueinfo, uint16_t & datatype, uint16_t & bitlength, uint16_t & objaccess, char * entryname, size_t entryname_size, uint32_t * abortcode = NULL, uint32_t timeout_us = 100000);
Parameters
[in] uint16_t od_index
Index of the object.[in] uint8_t od_subindex
Subindex of the object.[in] uint8_t valueinfo
NOTE: The parameter is currently invalid in the current version.
The value info includes which elements shall be returned:- Bit 0: reserved
- Bit 1: reserved
- Bit 2: reserved
- Bit 3: unit type
- Bit 4: default value
- Bit 5: minimum value
- Bit 6: maximum value
[out] uint16_t datatype
The variable used to store the data type. Please refer to A.6 Data Type.[out] uint16_t bitlength
Bit length of the object.[out] uint16_t objaccess
The attribute of access.- Bit 0: read access in Pre-Operational state
- Bit 1: read access in Safe-Operational state
- Bit 2: read access in Operational state
- Bit 3: write access in Pre-Operational state
- Bit 4: write access in Safe-Operational state
- Bit 5: write access in Operational state
- Bit 6: object is mappable in a RxPDO
- Bit 7: object is mappable in a TxPDO
- Bit 8: object can be used for backup
- Bit 9: object can be used for settings
- Bit 10-15: reserved
[out] char entryname
Name of the object entry. The buffer used to store the entry name.[in] size_t entryname_size
The size of the buffer for the entry name.[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 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; void setup() { uint16_t DataType, BitLength, ObjectAccess; uint8_t ValueInfo = 0; char EntryName[64]; Serial.begin(115200); master.begin(); slave.attach(0, master); slave.getEntryDescription(0x1C12, 0x01, ValueInfo, DataType, BitLength, ObjectAccess, EntryName, sizeof(EntryName)); Serial.print("Data Type : "); Serial.print(DataType, HEX); Serial.println("h"); Serial.print("Bit Length : "); Serial.print(BitLength, HEX); Serial.println("h"); Serial.print("Object Access : "); Serial.print(ObjectAccess, HEX); Serial.println("h"); Serial.print("Entry Name : "); Serial.println(EntryName); } void loop() { // Do nothing here }
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.