ECMC: EtherCAT open source motion control.
Motion control based on the open source EtherCAT master (www.etherlab.org). The motion package is integerated into the ESS EPCIS environment (E3).
|
EtherCAT commands. More...
Go to the source code of this file.
Functions | |
int | ecSetMaster (int masterIndex) |
Selects EtherCAT master to use. . | |
int | ecResetMaster (int masterIndex) |
Retry configuring slaves for an selected EtherCAT master. . | |
int | ecAddSlave (uint16_t alias, uint16_t position, uint32_t vendorId, uint32_t productCode) |
Adds an EtherCAT slave to the hardware configuration. . | |
int | ecAddSyncManager (int slaveIndex, int direction, uint8_t syncMangerIndex) |
obsolete command. Use ecAddEntryComplete() command instead. | |
int | ecAddPdo (int slaveIndex, int syncManager, uint16_t pdoIndex) |
obsolete command. Use ecAddEntryComplete() command instead. | |
int | ecAddEntryComplete (uint16_t slaveBusPosition, uint32_t vendorId, uint32_t productCode, int direction, uint8_t syncMangerIndex, uint16_t pdoIndex, uint16_t entryIndex, uint8_t entrySubIndex, uint8_t bits, char *entryIDString, int signedValue) |
int | ecAddEntry (uint16_t slaveBusPosition, uint32_t vendorId, uint32_t productCode, int direction, uint8_t syncMangerIndex, uint16_t pdoIndex, uint16_t entryIndex, uint8_t entrySubIndex, char *datatype, char *entryIDString, int updateInRealTime) |
Adds an EtherCAT slave to the hardware configuration. . | |
int | ecAddSdoAsync (uint16_t slaveBusPosition, uint16_t entryIndex, uint8_t entrySubIndex, char *datatype, char *idString) |
Adds an async SDO object. . | |
int | ecAddMemMapDT (char *ecPath, size_t byteSize, int direction, char *dataType, char *memMapIDString) |
Adds a memory map object to access data directly from EtherCAT domain. This is the preferred syntax. . | |
int | ecAddMemMap (uint16_t startEntryBusPosition, char *startEntryIDString, size_t byteSize, int direction, char *memMapIDString) |
Adds a memory map object to access data directly from EtherCAT domain. Support for this syntax might be dropped in newer releases. Please use new syntax. . | |
int | ecAddDataDT (char *ecPath, size_t entryByteOffset, size_t entryBitOffset, int direction, char *dataType, char *idString) |
Adds a data item object to access data directly from EtherCAT domain. This object type only support scalars (not arrays). For arrays see memmaps. . | |
int | ecGetMemMapId (char *memMapIDString, int *id) |
Get index of a memmap object based on its name id string. | |
int | ecSlaveConfigDC (int slaveBusPosition, uint16_t assignActivate, uint32_t sync0Cycle, int32_t sync0Shift, uint32_t sync1Cycle, int32_t sync1Shift) |
Configure slave DC clock. . | |
int | ecSelectReferenceDC (int masterIndex, int slaveBusPosition) |
Select EtherCAT reference clock. . | |
int | ecAddSdo (uint16_t slaveBusPosition, uint16_t sdoIndex, uint8_t sdoSubIndex, uint32_t value, int byteSize) |
Adds a Service Data Object for writing. | |
int | ecAddSdoDT (uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, char *valueString, char *datatype) |
Adds a Service Data Object for writing. | |
int | ecAddSdoComplete (uint16_t slaveBusPosition, uint16_t sdoIndex, const char *valueBuffer, int byteSize) |
Adds a Service Data Object for writing. | |
int | ecAddSdoBuffer (uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, const char *valueBuffer, int byteSize) |
Adds a Service Data Object for writing. | |
int | ecWriteSdo (uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, uint32_t value, int byteSize) |
Write to a Service Data Object. | |
int | ecSetDomAllowOffline (int allow) |
Allow domain to be offline. | |
int | ecSetEcAllowOffline (int allow) |
Allow master to be offline. | |
int | ecAddDomain (int rateCycles, int offsetCycles) |
Add domain. | |
int | ecReadSdo (uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, int byteSize, uint32_t *value) |
Write to a Service Data Object. | |
int | ecVerifySdo (uint16_t slavePosition, uint16_t sdoIndex, uint8_t sdoSubIndex, uint32_t verValue, int byteSize) |
Verify a Service Data Object. | |
int | ecReadSoE (uint16_t slavePosition, uint8_t driveNo, uint16_t idn, size_t byteSize, uint8_t *value) |
Read SoE . | |
int | ecWriteSoE (uint16_t slavePosition, uint8_t driveNo, uint16_t idn, size_t byteSize, uint8_t *value) |
Write SoE . | |
int | ecSlaveConfigWatchDog (int slaveBusPosition, int watchdogDivider, int watchdogIntervals) |
Configure Slave watch dog. . | |
int | ecApplyConfig (int masterIndex) |
Apply hardware configuration to master. . | |
int | writeEcEntry (int slaveIndex, int entryIndex, uint64_t value) |
Writes a value to an EtherCAT entry. . | |
int | writeEcEntryIDString (int slaveBusPosition, char *entryIdString, uint64_t value) |
Writes a value to an EtherCAT entry addressed by slaveBusPosition and entryIdString. . | |
int | readEcEntry (int slaveIndex, int entryIndex, uint64_t *value) |
Read a value from an EtherCAT entry. . | |
int | readEcEntryIDString (int slavePosition, char *entryIDString, uint64_t *value) |
Read a value from an EtherCAT entry addressed by slaveBusPosition and entryIdString. . | |
int | readEcEntryIndexIDString (int slavePosition, char *entryIDString, int *value) |
Read the object Index of an entry addressed by slaveBusPosition and entryIdString. . | |
int | readEcSlaveIndex (int slavePosition, int *value) |
Read the object Index of an slave addressed by slaveBusPosition. . | |
int | readEcMemMap (const char *memMapIDString, uint8_t *data, size_t bytesToRead, size_t *bytesRead) |
Read EtherCAT memory map object. | |
int | ecSetEntryUpdateInRealtime (uint16_t slavePosition, char *entryIDString, int updateInRealtime) |
Set update in realtime bit for an entry. | |
int | ecSetDiagnostics (int enable) |
Enable EtherCAT bus diagnostics. . | |
int | ecSetDomainFailedCyclesLimit (int cycles) |
Set allowed bus cycles in row of none complete domain data transfer. . | |
int | ecResetError () |
Reset error on all EtherCat objects. . | |
int | ecEnablePrintouts (int value) |
Enable diagnostic printouts from EtherCAT objects. . | |
int | ecSetDelayECOkAtStartup (int milliseconds) |
Delay ethercat OK status for a time. | |
int | ecPrintAllHardware () |
Prints all hardware connected to selected master. . | |
int | ecPrintSlaveConfig (int slaveIndex) |
Prints hardware configuration for a selected slave. . | |
int | linkEcEntryToEcStatusOutput (int slaveIndex, char *entryIDString) |
Links an EtherCAT entry to the ethecat master object for hardware status output . | |
int | ecVerifySlave (uint16_t alias, uint16_t slavePos, uint32_t vendorId, uint32_t productCode, uint32_t revisionNum) |
Verfy slave at position. | |
int | ecGetSlaveVendorId (uint16_t alias, uint16_t slavePos, uint32_t *result) |
Read vendor id of selected ethercat slave. | |
int | ecGetSlaveProductCode (uint16_t alias, uint16_t slavePos, uint32_t *result) |
Read product code of selected ethercat slave. | |
int | ecGetSlaveRevisionNum (uint16_t alias, uint16_t slavePos, uint32_t *result) |
revision number id of selected ethercat slave | |
int | ecGetSlaveSerialNum (uint16_t alias, uint16_t slavePos, uint32_t *result) |
Read serial number of selected ethercat slave. | |
int | ecUseClockRealtime (int useClkRT) |
Use CLOCK_REALTIME. | |
EtherCAT commands.
int ecAddDataDT | ( | char * | ecPath, |
size_t | entryByteOffset, | ||
size_t | entryBitOffset, | ||
int | direction, | ||
char * | dataType, | ||
char * | idString ) |
Adds a data item object to access data directly from EtherCAT domain. This object type only support scalars (not arrays). For arrays see memmaps.
.
The start of the data item is addressed by a previously configured EtherCAT entry, byte-, bit-offset and data type.
[in] | ecPath | Identification string of the start EtherCAT
|
[in] | entryByteOffset | offset in bytes. |
[in] | entryBitOffset | additional offset in bits |
[in] | direction | Data transfer direction.. direction = 1: Output (from master). direction = 2: Input (to master). |
[in] | dataType | DataType of ethercat data: B1: 1-bit B2: 2-bits (lsb) B3: 3-bits (lsb) B4: 4-bits (lsb) U8: Unsigned 8-bit S8: Signed 8-bit U16: Unsigned 16-bit S16: Signed 16-bit U32: Unsigned 32-bit S32: Signed 32-bit U64: Unsigned 64-bit S64: Signed 64-bit F32: Real 32-bit F64: Double 64-bit |
[in] | idString | Identification string used for addressing the object. ("ec<masterid>.s<slaveid>" will be used as prefix) |
int ecAddDomain | ( | int | rateCycles, |
int | offsetCycles ) |
Add domain.
[in] | rate | execute domain in this rate (cycles) |
[in] | offset | offset cycles |
int ecAddEntry | ( | uint16_t | slaveBusPosition, |
uint32_t | vendorId, | ||
uint32_t | productCode, | ||
int | direction, | ||
uint8_t | syncMangerIndex, | ||
uint16_t | pdoIndex, | ||
uint16_t | entryIndex, | ||
uint8_t | entrySubIndex, | ||
char * | datatype, | ||
char * | entryIDString, | ||
int | updateInRealTime ) |
Adds an EtherCAT slave to the hardware configuration.
.
Each added slave will be assigned an additional index which will be zero for the first successfully added slave and then incremented for each successful call to "Cfg.EcAddSlave()".
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | vendorId | Identification value for slave vendor. vendorId = 0x2: Beckhoff. vendorId = 0x48554B: Kendrion Kuhnke Automation GmbH. |
[in] | productCode | Product identification code. productCode=0x13ed3052: EL5101 incremental encoder input. |
[in] | direction | Data transfer direction.. direction = 1: Output (from master). direction = 2: Input (to master). |
[in] | syncMangerIndex | Index of sync manager. |
[in] | pdoIndex | Index of process data object. Needs to be entered in hex format. |
[in] | entryIndex | Index of process data object entry. Needs to be entered in hex format. |
[in] | entrySubIndex | Index of process data object sub entry. Needs to be entered in hex format. |
[in] | dataType | DataType of ethercat data: B1: 1-bit B2: 2-bits (lsb) B3: 3-bits (lsb) B4: 4-bits (lsb) U8: Unsigned 8-bit S8: Signed 8-bit U16: Unsigned 16-bit S16: Signed 16-bit U32: Unsigned 32-bit S32: Signed 32-bit U64: Unsigned 64-bit S64: Signed 64-bit F32: Real 32-bit F64: Double 64-bit |
[in] | entryIDString | Identification string used for addressing the entry. |
[in] | updateInRT | 1 if value should be updated in realtime 0 normally set to zero for entries that are covered in memmaps. |
int ecAddEntryComplete | ( | uint16_t | slaveBusPosition, |
uint32_t | vendorId, | ||
uint32_t | productCode, | ||
int | direction, | ||
uint8_t | syncMangerIndex, | ||
uint16_t | pdoIndex, | ||
uint16_t | entryIndex, | ||
uint8_t | entrySubIndex, | ||
uint8_t | bits, | ||
char * | entryIDString, | ||
int | signedValue ) |
\breif Adds an EtherCAT slave to the hardware configuration.
Each added slave will be assigned an additional index which will be zero for the first successfully added slave and then incremented for each successful call to "Cfg.EcAddSlave()".
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | vendorId | Identification value for slave vendor. vendorId = 0x2: Beckhoff. vendorId = 0x48554B: Kendrion Kuhnke Automation GmbH. |
[in] | productCode | Product identification code. productCode=0x13ed3052: EL5101 incremental encoder input. |
[in] | direction | Data transfer direction.. direction = 1: Output (from master). direction = 2: Input (to master). |
[in] | syncMangerIndex | Index of sync manager. |
[in] | pdoIndex | Index of process data object. Needs to be entered in hex format. |
[in] | entryIndex | Index of process data object entry. Needs to be entered in hex format. |
[in] | entrySubIndex | Index of process data object sub entry. Needs to be entered in hex format. |
[in] | bits | Bit count. |
[in] | entryIDString | Identification string used for addressing the entry. |
[in] | signedValue | 1 if value is of signed type otherwise 0 |
int ecAddMemMap | ( | uint16_t | startEntryBusPosition, |
char * | startEntryIDString, | ||
size_t | byteSize, | ||
int | direction, | ||
char * | memMapIDString ) |
Adds a memory map object to access data directly from EtherCAT
domain. Support for this syntax might be dropped in newer releases.
Please use new syntax.
.
The start of the memory map is addressed by a previously configured EtherCAT entry and a size.
[in] | startEntryBusPosition | Position of the EtherCAT slave on the bus where the start entry is configured. startEntryBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | startEntryIDString | I Identification string of the start EtherCAT
|
[in] | byteSize | Size of memory map objects (size to access). |
[in] | direction | Data transfer direction.. direction = 1: Output (from master). direction = 2: Input (to master). |
[in] | entryIDString | Identification string used for addressing the object. |
int ecAddMemMapDT | ( | char * | ecPath, |
size_t | byteSize, | ||
int | direction, | ||
char * | dataType, | ||
char * | memMapIDString ) |
Adds a memory map object to access data directly from EtherCAT domain. This is the preferred syntax.
.
The start of the memory map is addressed by a previously configured EtherCAT entry and a size.
[in] | ecPath | Identification string of the start EtherCAT
|
[in] | byteSize | Size of memory map objects (size to access). |
[in] | direction | Data transfer direction.. direction = 1: Output (from master). direction = 2: Input (to master). |
[in] | dataType | DataType of ethercat data: U8: Unsigned 8-bit S8: Signed 8-bit U16: Unsigned 16-bit S16: Signed 16-bit U32: Unsigned 32-bit S32: Signed 32-bit U64: Unsigned 64-bit S64: Signed 64-bit F32: Real 32-bit F64: Double 64-bit |
[in] | memMapIdString | Identification string used for addressing the object. |
"Cfg.EcAddMemMapDT(ec0.s10.AI1,200,2,S32,ec0.s10.mm.WAVEFORM)" //Command string to ecmcCmdParser.c
int ecAddSdo | ( | uint16_t | slaveBusPosition, |
uint16_t | sdoIndex, | ||
uint8_t | sdoSubIndex, | ||
uint32_t | value, | ||
int | byteSize ) |
Adds a Service Data Object for writing.
Adds a Service Data Object for writing to the sdo registers of EtherCAT slaves. An sdo object will be added to the hardware configuration. The writing will occur when the hardware configuration is applied.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | sdoSubIndex | Sub index of service data object . Needs to be entered in hex format. |
[in] | value | Value to write. |
[in] | byteSize | Byte count to write. |
int ecAddSdoAsync | ( | uint16_t | slaveBusPosition, |
uint16_t | entryIndex, | ||
uint8_t | entrySubIndex, | ||
char * | datatype, | ||
char * | idString ) |
Adds an async SDO object.
.
Adds a SDO object for SDO read and write during realtime.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | index | Index of process data object entry. Needs to be entered in hex format. |
[in] | subIndex | Index of process data object sub entry. Needs to be entered in hex format. |
[in] | dataType | DataType of ethercat data: U8: Unsigned 8-bit S8: Signed 8-bit U16: Unsigned 16-bit S16: Signed 16-bit U32: Unsigned 32-bit S32: Signed 32-bit U64: Unsigned 64-bit S64: Signed 64-bit F32: Real 32-bit F64: Double 64-bit |
[in] | idString | Identification string used for addressing the entry. |
int ecAddSdoBuffer | ( | uint16_t | slavePosition, |
uint16_t | sdoIndex, | ||
uint8_t | sdoSubIndex, | ||
const char * | valueBuffer, | ||
int | byteSize ) |
Adds a Service Data Object for writing.
Adds a Service Data Object for writing to the sdo registers of EtherCAT slaves. An sdo object will be added to the hardware configuration. The writing will occur when the hardware configuration is applied.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | sdoSubIndex | Sub index of service data object. Needs to be entered in hex format. |
[in] | valueBuffer | Values to be written as hex string, each byte separted with space. |
[in] | byteSize | Byte count to write. |
int ecAddSdoComplete | ( | uint16_t | slaveBusPosition, |
uint16_t | sdoIndex, | ||
const char * | valueBuffer, | ||
int | byteSize ) |
Adds a Service Data Object for writing.
Adds a Service Data Object for writing to the sdo registers of EtherCAT slaves. An sdo object will be added to the hardware configuration. The writing will occur when the hardware configuration is applied.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | valueBuffer | Values to be written as hex string, each byte separted with space. |
[in] | byteSize | Byte count to write. |
int ecAddSdoDT | ( | uint16_t | slavePosition, |
uint16_t | sdoIndex, | ||
uint8_t | sdoSubIndex, | ||
char * | valueString, | ||
char * | datatype ) |
Adds a Service Data Object for writing.
Adds a Service Data Object for writing to the sdo registers of EtherCAT slaves. An sdo object will be added to the hardware configuration. The writing will occur when the hardware configuration is applied.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | sdoSubIndex | Sub index of service data object . Needs to be entered in hex format. |
[in] | valueString | Value to write. |
[in] | dataType | ecmc data type string. U8: Unsigned 8-bit S8: Signed 8-bit U16: Unsigned 16-bit S16: Signed 16-bit U32: Unsigned 32-bit S32: Signed 32-bit U64: Unsigned 64-bit S64: Signed 64-bit F32: Real 32-bit F64: Double 64-bit |
int ecAddSlave | ( | uint16_t | alias, |
uint16_t | position, | ||
uint32_t | vendorId, | ||
uint32_t | productCode ) |
Adds an EtherCAT slave to the hardware configuration.
.
Each added slave will be assigned an additional index which will be zero for the first successfully added slave and then incremented for each successful call to "Cfg.EcAddSlave()".
NOTE: if an complete entry needs to be configured the command "Cfg.EcAddEntryComplete()" should be used. This command will add slave, sync. manger, pdo and entry if needed.
alias | Alias of slave. Set to zero to disable. |
slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
vendorId | Identification value for slave vendor. vendorId = 0x2: Beckhoff. vendorId = 0x48554B: Kendrion Kuhnke Automation GmbH. |
productCode | Product identification code. productCode=0x13ed3052: EL5101 incremental encoder input. |
int ecApplyConfig | ( | int | masterIndex | ) |
Apply hardware configuration to master.
.
This command needs to be executed before entering runtime.
[in] | masterIndex | Index of master, see command ecSetMaster(). |
int ecEnablePrintouts | ( | int | value | ) |
Enable diagnostic printouts from EtherCAT objects.
.
Enables/Disables diagnostic printouts from:
[in] | enable | Enable diagnostic printouts. |
int ecGetMemMapId | ( | char * | memMapIDString, |
int * | id ) |
Get index of a memmap object based on its name id string.
[in] | memMapIDString | memmap name |
[out] | index | index of memmap corresponding to memMapIDString |
int ecGetSlaveProductCode | ( | uint16_t | alias, |
uint16_t | slavePos, | ||
uint32_t * | result ) |
Read product code of selected ethercat slave.
[in] | alias | Alias of slave. Set to zero to disable. |
[in] | slaveIn | Position of the EtherCAT slave on the bus. slaveIndex = 0..65535: Addressing of normal EtherCAT slaves. |
[out] | result | Product code. |
alias | Slave alias. |
slavePos | Slave position. |
int ecGetSlaveRevisionNum | ( | uint16_t | alias, |
uint16_t | slavePos, | ||
uint32_t * | result ) |
revision number id of selected ethercat slave
[in] | alias | Alias of slave. Set to zero to disable. |
[in] | slaveIn | Position of the EtherCAT slave on the bus. slaveIndex = 0..65535: Addressing of normal EtherCAT slaves. |
[out] | result | Revision number. |
alias | Slave alias. |
slavePos | Slave position. |
int ecGetSlaveSerialNum | ( | uint16_t | alias, |
uint16_t | slavePos, | ||
uint32_t * | result ) |
Read serial number of selected ethercat slave.
[in] | alias | Alias of slave. Set to zero to disable. |
[in] | slaveIn | Position of the EtherCAT slave on the bus. slaveIndex = 0..65535: Addressing of normal EtherCAT slaves. |
[out] | result | Serial number. |
alias | Slave alias. |
slavePos | Slave position. |
int ecGetSlaveVendorId | ( | uint16_t | alias, |
uint16_t | slavePos, | ||
uint32_t * | result ) |
Read vendor id of selected ethercat slave.
[in] | alias | Alias of slave. Set to zero to disable. |
[in] | slaveIn | Position of the EtherCAT slave on the bus. slaveIndex = 0..65535: Addressing of normal EtherCAT slaves. |
[out] | result | Vendor id. |
alias | Slave alias. |
slavePos | Slave position. |
int ecPrintAllHardware | ( | ) |
Prints all hardware connected to selected master.
.
int ecPrintSlaveConfig | ( | int | slaveIndex | ) |
Prints hardware configuration for a selected slave.
.
int ecReadSdo | ( | uint16_t | slavePosition, |
uint16_t | sdoIndex, | ||
uint8_t | sdoSubIndex, | ||
int | byteSize, | ||
uint32_t * | value ) |
Write to a Service Data Object.
Note: same as "ecWriteSdo(uint16_t slavePposition,uint16_t sdoIndex,uint8_t sdoSubIndex, uint32_t value,int byteSize)" but without subindex. Complete SDO access will be used.
Read a Service Data Object.
Read will occur directly when the command is issued.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | sdoSubIndex | Sub index of service data object . Needs to be entered in hex format. |
[in] | byteSize | Byte count to read. |
[out] | data | Read data. |
int ecReadSoE | ( | uint16_t | slavePosition, |
uint8_t | driveNo, | ||
uint16_t | idn, | ||
size_t | byteSize, | ||
uint8_t * | value ) |
Read SoE
.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | driveNo | SoE drive number. |
[in] | idn | SoE IDN. |
[in] | byteSize | Byte count to read. |
[out] | value | Pointer to read data. |
slavePosition | Slave position. |
driveNo | Drive number. |
idn | SoE IDN (see ecrt_slave_config_idn()). |
byteSize | Size of data to write. |
value | Pointer to data to write. |
int ecResetError | ( | ) |
Reset error on all EtherCat objects.
.
Resets error on the following object types:
int ecResetMaster | ( | int | masterIndex | ) |
Retry configuring slaves for an selected EtherCAT master.
.
Via this method, the application can tell the master to bring all slaves to OP state. In general, this is not necessary, because it is automatically done by the master. But with special slaves, that can be reconfigured by the vendor during runtime, it can be useful.
[in] | masterIndex | EtherCAT master index. |
int ecSelectReferenceDC | ( | int | masterIndex, |
int | slaveBusPosition ) |
Select EtherCAT reference clock.
.
[in] | masterIndex | Index of master, see command ecSetMaster(). |
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. Note: the slave needs to be equipped with a DC. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. * |
int ecSetDelayECOkAtStartup | ( | int | milliseconds | ) |
Delay ethercat OK status for a time.
This can be usefull to allow extra time foir DC clocks to syncronize or
for slave that do not report correct data directlly when enter OP.
[in] | milliseconds | Delay time for ecOK status at startup (after slaves in OP). |
int ecSetDiagnostics | ( | int | enable | ) |
Enable EtherCAT bus diagnostics.
.
Diagnostics are made at three different levels:
[in] | enable | Enable diagnostics. |
int ecSetDomainFailedCyclesLimit | ( | int | cycles | ) |
Set allowed bus cycles in row of none complete domain data transfer.
.
Allows a certain number of bus cycles of non-complete domain data transfer before alarming.
[in] | cycles | Number of cycles. |
int ecSetDomAllowOffline | ( | int | allow | ) |
Allow domain to be offline.
[in] | allow | 0 ==dont't allow (default), 1 == allow |
int ecSetEcAllowOffline | ( | int | allow | ) |
Allow master to be offline.
[in] | allow | 0 ==dont't allow (default), 1 == allow |
int ecSetEntryUpdateInRealtime | ( | uint16_t | slavePosition, |
char * | entryIDString, | ||
int | updateInRealtime ) |
Set update in realtime bit for an entry.
If set to zero the entry will not be updated during realtime operation.
Useful when accessing data with memory maps instead covering many entries like oversampling arrays (it's then unnecessary to update each entry in array).
[in] | slavePosition | Position of the EtherCAT slave on the bus. slavePosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | entryIdString | String for addressing purpose (see command "Cfg.EcAddEntryComplete() for more information"). |
[in] | updateInRealtime | 1 for update of entry data in realtime and 0 not to update data in realtime. |
int ecSetMaster | ( | int | masterIndex | ) |
Selects EtherCAT master to use.
.
[in] | masterIndex | EtherCAT master index. |
int ecSlaveConfigDC | ( | int | slaveBusPosition, |
uint16_t | assignActivate, | ||
uint32_t | sync0Cycle, | ||
int32_t | sync0Shift, | ||
uint32_t | sync1Cycle, | ||
int32_t | sync1Shift ) |
Configure slave DC clock.
.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. * |
[in] | assignActivate | A* Each added slave will be assigned an additional index which will be zero for the first successfully added slave and then incremented for each successful call to "Cfg.EcAddSlave()". assign active word. This information can be found in the ESI slave description file. Needs to be entered in hex format. |
[in] | sync0Cycle | Cycle time in ns. |
[in] | sync0Shift | Phase shift in ns. |
[in] | sync1Cycle | Cycle time in ns. |
[in] | sync1Shift | Not used. |
assignActivate | AssignActivate word. |
sync0Cycle | SYNC0 cycle time [ns]. |
sync0Shift | SYNC0 shift time [ns]. |
sync1Cycle | SYNC1 cycle time [ns]. |
sync1Shift | SYNC1 shift time [ns]. |
int ecSlaveConfigWatchDog | ( | int | slaveBusPosition, |
int | watchdogDivider, | ||
int | watchdogIntervals ) |
Configure Slave watch dog.
.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. Note: the slave needs to be equipped with a DC. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | watchdogDivider | Number of 40 ns intervals. Used as a base unit for all slave watchdogs. If set to zero, the value is not written, so the default is used. |
[in] | watchdogIntervals | Number of base intervals for process data watchdog. If set to zero, the value is not written, so the default is used. |
int ecUseClockRealtime | ( | int | useClkRT | ) |
Use CLOCK_REALTIME.
Ecmc will as default use CLOCK_MONOTONIC as clock source both for
the RT loop and the ethercat bus.
[in] | useClkRT | Select clock useClkRT = 0: Use CLOCK_MONOTONIC. useClkRT = 1: Use CLOCK_REALTIME. |
int ecVerifySdo | ( | uint16_t | slavePosition, |
uint16_t | sdoIndex, | ||
uint8_t | sdoSubIndex, | ||
uint32_t | verValue, | ||
int | byteSize ) |
Verify a Service Data Object.
Read will occur directly when the command is issued.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | sdoSubIndex | Sub index of service data object . Needs to be entered in hex format. |
[in] | byteSize | Byte count to read. |
[in] | verValue | Expected value of SDO. |
int ecVerifySlave | ( | uint16_t | alias, |
uint16_t | slavePos, | ||
uint32_t | vendorId, | ||
uint32_t | productCode, | ||
uint32_t | revisionNum ) |
Verfy slave at position.
The command verifys that the actual slave at a certain position\ have the correct alias, position, vendor id, product code and revision number.
Check of slave revsion number will be skipped if set to 0.
[in] | alias | Alias of slave. Set to zero to disable. |
[in] | slaveIn | Position of the EtherCAT slave on the bus. slaveIndex = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | vendorId | Identification value for slave vendor. vendorId = 0x2: Beckhoff. vendorId = 0x48554B: Kendrion Kuhnke Automation GmbH. |
productCode | Product identification code. productCode=0x13ed3052: EL5101 incremental encoder input. | |
revisionNum | Product revision number. The revsion number of the actual slave needs to equal or newer than that of the configuration. if revisionNum==0 then this function will not check revsionNum of the slave. revisionNum=0x04000000: EL5101 incremental encoder input. |
alias | Slave alias. |
slavePos | Slave position. |
vendorId | Expected vendor ID. |
productCode | Expected product code. |
revisionNum | Revision number |
int ecWriteSdo | ( | uint16_t | slavePosition, |
uint16_t | sdoIndex, | ||
uint8_t | sdoSubIndex, | ||
uint32_t | value, | ||
int | byteSize ) |
Write to a Service Data Object.
Writing will occur directly when the command is issued.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | sdoIndex | Index of service data object. Needs to be entered in hex format. |
[in] | sdoSubIndex | Sub index of service data object . Needs to be entered in hex format. |
[in] | value | Value to write. |
[in] | byteSize | Byte count to write. |
int ecWriteSoE | ( | uint16_t | slavePosition, |
uint8_t | driveNo, | ||
uint16_t | idn, | ||
size_t | byteSize, | ||
uint8_t * | value ) |
Write SoE
.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = 0..65535: Addressing of EtherCAT slaves. |
[in] | driveNo | SoE drive number. |
[in] | idn | SoE IDN. |
[in] | byteSize | Byte count to write. |
[out] | value | Pointer to data to write. |
slavePosition | Slave position. |
driveNo | Drive number. |
idn | SoE IDN (see ecrt_slave_config_idn()). |
byteSize | Size of data to write. |
value | Pointer to data to write. |
int linkEcEntryToEcStatusOutput | ( | int | slaveIndex, |
char * | entryIDString ) |
Links an EtherCAT entry to the ethecat master object for hardware status output
.
The output will be high when the EtherCAT master is without error code and otherwise zero.
[in] | slaveIndex | Position of the EtherCAT slave on the bus. slaveIndex = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveIndex = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | entryIdString | String for addressing purpose (see command "Cfg.EcAddEntryComplete() for more information"). |
int readEcEntry | ( | int | slaveIndex, |
int | entryIndex, | ||
uint64_t * | value ) |
Read a value from an EtherCAT entry.
.
[in] | slaveIndex | Index of order of added slave (not bus position), see command EcAddSlave()). |
[in] | entryIndex | Index of order of added entry (within slave). |
[out] | value | Read value (result). |
int readEcEntryIDString | ( | int | slavePosition, |
char * | entryIDString, | ||
uint64_t * | value ) |
Read a value from an EtherCAT entry addressed by slaveBusPosition and entryIdString.
.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | entryIdString | String for addressing purpose (see command "Cfg.EcAddEntryComplete() for more information"). |
[out] | value | Read value (result). Note: This command should not be used when realtime performance is needed (also see "WriteECEntry()" command). |
int readEcEntryIndexIDString | ( | int | slavePosition, |
char * | entryIDString, | ||
int * | value ) |
Read the object Index of an entry addressed by slaveBusPosition and entryIdString.
.
The first entry added in a slave will receive index 0, then for each added entry, its index will be incremented by one. This index will be returned by this function. This index is needed to address a certain slave with the commands readEcEntry() and writeEcEntry() (for use in realtime, since these functions address the slave and entry arrays directly via indices).
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | entryIdString | String for addressing purpose (see command "Cfg.EcAddEntryComplete() for more information"). |
[out] | value | Entry index (the order is was added). |
int readEcMemMap | ( | const char * | memMapIDString, |
uint8_t * | data, | ||
size_t | bytesToRead, | ||
size_t * | bytesRead ) |
Read EtherCAT memory map object.
Fast access of EtherCAT data from EPICS records is possible by linking an EtherCAT memory map to an ASYN parameter. The memory map objects is most usefull for acquire arrays of data (waveforms).This function is called by the iocsh command"ecmcAsynPortDriverAddParameter()". For more information see documentation of ecmcAsynPortDriverAddParameter(), ecAddMemMap(), readEcMemMap() and ecSetEntryUpdateInRealtime().
[in] | memMapIDString | String for addressing ethercat entry: ec.mm.<memory map id> |
[out] | *data | Output data buffer. * |
[in] | bytesToRead | Output data buffer size. * |
[out] | bytesRead | Bytes read. * |
int readEcSlaveIndex | ( | int | slavePosition, |
int * | value ) |
Read the object Index of an slave addressed by slaveBusPosition.
.
The first slave added in will receive index 0, then for each added slave, its index will be incremented by one. This index will be returned by this function. This index is needed to address a certain slave with the commands readEcEntry() and writeEcEntry() (for use in realtime, since these functions address the slave and entry arrays directly via indices).
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
int writeEcEntry | ( | int | slaveIndex, |
int | entryIndex, | ||
uint64_t | value ) |
Writes a value to an EtherCAT entry.
.
[in] | slaveIndex | Index of order of added slave (not bus position), see command EcAddSlave()). |
[in] | entryIndex | Index of order of added entry (within slave). |
[in] | value | Value to be written. |
int writeEcEntryIDString | ( | int | slaveBusPosition, |
char * | entryIdString, | ||
uint64_t | value ) |
Writes a value to an EtherCAT entry addressed by slaveBusPosition and entryIdString.
.
[in] | slaveBusPosition | Position of the EtherCAT slave on the bus. slaveBusPosition = -1: Used to address the simulation slave. Only two entries are configured, "ZERO" with default value 0 and "ONE" with default value 1. slaveBusPosition = 0..65535: Addressing of normal EtherCAT slaves. |
[in] | entryIdString | String for addressing purpose (see command "Cfg.EcAddEntryComplete() for more information"). |
[in] | value | Value to be written. Note: This command should not be used when realtime performance is needed (also see "WriteECEntry()" command). |