9.4. Slave status functions
9.4.1. emonGetNumConfiguredSlaves
9.4.2. emonGetNumConnectedSlaves
9.4.3. emonGetSlaveId
-
EC_T_DWORD emonGetSlaveId(EC_T_DWORD dwInstanceID, EC_T_WORD wStationAddress)
Determines the slave ID using the slave station address.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
wStationAddress – [in] Station address of the slave
- Returns
Slave ID or INVALID_SLAVE_ID if the slave could not be found or stack is not initialized
9.4.4. emonGetSlaveIdAtPosition
-
EC_T_DWORD emonGetSlaveIdAtPosition(EC_T_DWORD dwInstanceID, EC_T_WORD wAutoIncAddress)
Determines the slave ID using the slave auto increment address.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
wAutoIncAddress – [in] Auto increment address of the slave
- Returns
Slave ID or INVALID_SLAVE_ID if no slave matching wAutoIncAddress can be found
9.4.5. emonGetSlaveState
-
EC_T_DWORD emonGetSlaveState(EC_T_DWORD dwInstanceID, EC_T_DWORD dwSlaveId, EC_T_WORD *pwCurrDevState, EC_T_WORD *pwReqDevState)
Get the slave state.
The slave state is always read automatically from the AL_STATUS register whenever necessary. It is not forced by calling this function. This function may be called from within the JobTask’s context.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
dwSlaveId – [in] Slave ID
pwCurrDevState – [out] Current slave state.
pwReqDevState – [out] Requested slave state
- Returns
EC_E_NOERROR if successful.
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointers are EC_NULL
EC_E_SLAVE_NOT_PRESENT if slave not present.
EC_E_NOTFOUND if no slave matching dwSlaveId can be found
Limitation
Since it is not possible to determine the actual requested slave state from the master, the highest slave state of all slaves is assumed to be the requested state.
9.4.6. emonIsSlavePresent
-
EC_T_DWORD emonIsSlavePresent(EC_T_DWORD dwInstanceID, EC_T_DWORD dwSlaveId, EC_T_BOOL *pbPresence)
Returns whether a specific slave is currently connected to the Bus.
This function may be called from within the JobTask.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
dwSlaveId – [in] Slave ID
pbPresence – [out] EC_TRUE if slave is currently connected to the bus, EC_FALSE if not.
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range
EC_E_NOTFOUND if no slave matching dwSlaveId can be found
9.4.7. emonGetSlaveProp
-
EC_T_BOOL emonGetSlaveProp(EC_T_DWORD dwInstanceID, EC_T_DWORD dwSlaveId, EC_T_SLAVE_PROP *pSlaveProp)
Determines the properties of the slave device.
- Deprecated:
Use emGetCfgSlaveInfo instead
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
dwSlaveId – [in] Slave ID
pSlaveProp – [out] Slave properties
- Returns
EC_TRUE if the slave exists, EC_FALSE if no slave matching dwSlaveId can be found
See also
9.4.8. emonGetSlaveInpVarInfoNumOf
-
EC_T_DWORD emonGetSlaveInpVarInfoNumOf(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD *pwSlaveInpVarInfoNumOf)
Gets the number of input variables of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
pwSlaveInpVarInfoNumOf – [out] Number of found process variable entries
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL
EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found
9.4.9. emonGetSlaveInpVarInfo
-
EC_T_DWORD emonGetSlaveInpVarInfo(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wNumOfVarsToRead, EC_T_PROCESS_VAR_INFO *pSlaveProcVarInfoEntries, EC_T_WORD *pwReadEntries)
Gets the process variable information entries of an specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wNumOfVarsToRead – [in] Number process variable entries that have been stored in pSlaveProcVarInfoEntries
pSlaveProcVarInfoEntries – [out] The read process variable information entries
pwReadEntries – [out] The number of read process variable information entries
- Returns
EC_E_NOERROR or error code
9.4.10. emonGetSlaveInpVarInfoEx
-
EC_T_DWORD emonGetSlaveInpVarInfoEx(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wNumOfVarsToRead, EC_T_PROCESS_VAR_INFO_EX *pSlaveProcVarInfoEntriesEx, EC_T_WORD *pwReadEntries)
Gets the input process variable extended information entries of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wNumOfVarsToRead – [in] Number process variable entries that have been stored in pSlaveProcVarInfoEntries
pSlaveProcVarInfoEntriesEx – [out] The read process variable extended information entries
pwReadEntries – [out] The number of read process variable information entries
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range or the output pointer is EC_NULL
EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found
-
struct EC_T_PROCESS_VAR_INFO_EX
Public Members
-
EC_T_WORD wDataType
[out] Data type of the found process variable (according to ETG.1000, section 5). See also EcCommon.h, DEFTYPE_BOOLEAN
-
EC_T_BOOL bIsInputData
[out] Determines whether the found process variable is an input variable or an output variable
-
EC_T_WORD wDataType
9.4.11. emonGetSlaveOutpVarInfoNumOf
-
EC_T_DWORD emonGetSlaveOutpVarInfoNumOf(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD *pwSlaveOutpVarInfoNumOf)
Gets the number of output variables of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
pwSlaveOutpVarInfoNumOf – [out] Number of found process variables
- Returns
EC_E_NOERROR or error code
9.4.12. emonGetSlaveOutpVarInfo
-
EC_T_DWORD emonGetSlaveOutpVarInfo(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wNumOfVarsToRead, EC_T_PROCESS_VAR_INFO *pSlaveProcVarInfoEntries, EC_T_WORD *pwReadEntries)
Gets the output process variable information entries of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wNumOfVarsToRead – [in] Number of found process variable entries
pSlaveProcVarInfoEntries – [out] The read process variable information entries
pwReadEntries – [out] The number of read process variable information entries
- Returns
EC_E_NOERROR or error code
See also
9.4.13. emonGetSlaveOutpVarInfoEx
-
EC_T_DWORD emonGetSlaveOutpVarInfoEx(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wNumOfVarsToRead, EC_T_PROCESS_VAR_INFO_EX *pSlaveProcVarInfoEntriesEx, EC_T_WORD *pwReadEntries)
Gets the output process variable extended information entries of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wNumOfVarsToRead – [in] Number of process variable information entries
pSlaveProcVarInfoEntriesEx – [out] The read process extended variable entries
pwReadEntries – [out] The number of read process variable information entries
- Returns
EC_E_NOERROR or error code
See also
9.4.14. emonGetSlaveInpVarByObjectEx
-
EC_T_DWORD emonGetSlaveInpVarByObjectEx(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wIndex, EC_T_WORD wSubIndex, EC_T_PROCESS_VAR_INFO_EX *pProcessVarInfoEntry)
Gets the input process variable extended information entry by object index, subindex of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wIndex – [in] Object Index
wSubIndex – [in] Object SubIndex
pProcessVarInfoEntry – [out] Process variable extended information entry
- Returns
EC_E_NOERROR or error code
See also
9.4.15. emonGetSlaveOutpVarByObjectEx
-
EC_T_DWORD emonGetSlaveOutpVarByObjectEx(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wIndex, EC_T_WORD wSubIndex, EC_T_PROCESS_VAR_INFO_EX *pProcessVarInfoEntry)
Gets the input process variable extended information entry by object index, subindex of a specific slave.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wIndex – [in] Object Index
wSubIndex – [in] Object SubIndex
pProcessVarInfoEntry – [out] Process variable extended information entry
- Returns
EC_E_NOERROR or error code
See also
9.4.16. emonReadSlaveRegister
-
EC_T_DWORD emonReadSlaveRegister(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_WORD wRegisterOffset, EC_T_BYTE *pbyData, EC_T_WORD wLen, EC_T_DWORD dwTimeout)
Reads data from the ESC memory that have so far been transferred to a slave and received by the EC-Monitor.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
wRegisterOffset – [in] Register offset. I.e. use 0x0130 to read the AL Status register.
pbyData – [out] Buffer receiving transferred data
wLen – [in] Number of bytes to receive
dwTimeout – [in] Timeout [ms]
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range or the command is not supported or the timeout value is set to EC_NOWAIT
EC_E_SLAVE_NOT_PRESENT if slave not present
EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found
EC_E_TIMEOUT if dwTimeout elapsed during the API call
EC_E_BUSY another transfer request is already pending or the master or the corresponding slave is currently changing its operational state
EC_E_NOTREADY if the working counter was not set when sending the command (slave may not be connected or did not respond)
EC_E_INVALIDSIZE if the size of the complete command does not fit into a single Ethernet frame. The maximum amount of data to transfer must not exceed 1486 bytes
9.4.17. emonGetCfgSlaveInfo
-
EC_T_DWORD emonGetCfgSlaveInfo(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_CFG_SLAVE_INFO *pSlaveInfo)
Return information about a configured slave from the ENI file.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
pSlaveInfo – [out] Information about the slave.
- Returns
EC_E_NOERROR or error code
-
struct EC_T_CFG_SLAVE_INFO
Public Members
-
EC_T_CHAR abyDeviceName[ECAT_DEVICE_NAMESIZE]
[out] Slave’s configured name (80 Byte) (from ENI file)
-
EC_T_DWORD dwMbxSupportedProtocols
[out] Mailbox protocols supported by the slave (from ENI file). Combination of Supported mailbox protocols flags
-
EC_T_WORD wWkcStateDiagOffsIn[EC_CFG_SLAVE_PD_SECTIONS]
[out] Offset of WkcState bit in diagnosis image (ENI: ProcessData/Recv[1..4]/BitStart): 0xFFFFFFFF = offset not available. WkcState bit values: 0 = Data valid, 1 = Data invalid
-
EC_T_WORD wWkcStateDiagOffsOut[EC_CFG_SLAVE_PD_SECTIONS]
[out] Offset of WkcState bit in diagnosis image (ENI: ProcessData/Send[1..4]/BitStart): 0xFFFFFFFF = offset not available. WkcState bit values: 0 = Data valid, 1 = Data invalid
-
EC_T_WORD awMasterSyncUnitIn[EC_CFG_SLAVE_PD_SECTIONS]
[out] Sync Unit (ENI: ProcessData/TxPdo[1..4]@Su)
-
EC_T_WORD awMasterSyncUnitOut[EC_CFG_SLAVE_PD_SECTIONS]
[out] Sync Unit (ENI: ProcessData/RxPdo[1..4]@Su)
-
EC_T_BOOL bDisconnected
[out] Slave disconnected by API (emSetSlaveDisconnected / emSetSlavesDisconnected).
-
EC_T_CHAR abyDeviceName[ECAT_DEVICE_NAMESIZE]
Flags EC_MBX_PROTOCOL_
9.4.18. emonGetCfgSlaveSmInfo
-
EC_T_DWORD emonGetCfgSlaveSmInfo(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_CFG_SLAVE_SM_INFO *pSlaveSmInfo)
Return information about Sync Master of a configured slave from the ENI file.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
pSlaveSmInfo – [out] Information about the slave.
- Returns
EC_E_NOERROR or error code
-
struct EC_T_CFG_SLAVE_SM_INFO
Public Members
-
EC_T_CFG_SLAVE_SM_ENTRY aoSmInfos[ECREG_SYNCMANAGER_MAX_NUMOF]
[out] Sync managers info
-
EC_T_CFG_SLAVE_SM_ENTRY aoSmInfos[ECREG_SYNCMANAGER_MAX_NUMOF]
Example
/* get information about slave's sync managers configured in ENI file */
EC_T_CFG_SLAVE_SM_INFO oSlaveSmInfo;
OsMemset(&oSlaveSmInfo, 0, sizeof(EC_T_CFG_SLAVE_SM_INFO));
dwRes = emonGetCfgSlaveSmInfo(dwInstanceId, EC_TRUE, 1001, &oSlaveSmInfo);
9.4.19. emonGetBusSlaveInfo
-
EC_T_DWORD emonGetBusSlaveInfo(EC_T_DWORD dwInstanceID, EC_T_BOOL bFixedAddressing, EC_T_WORD wSlaveAddress, EC_T_BUS_SLAVE_INFO *pSlaveInfo)
Return information about a slave connected to the EtherCAT bus.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
bFixedAddressing – [in] EC_TRUE: use station address, EC_FALSE: use AutoInc address
wSlaveAddress – [in] Slave address according bFixedAddressing
pSlaveInfo – [out] Information from the slave.
- Returns
EC_E_NOERROR if successful
EC_E_INVALIDSTATE if master isn’t initialized
EC_E_INVALIDPARM if dwInstanceID is out of range
EC_E_NOTFOUND if no slave matching bFixedAddressing / wSlaveAddress can be found
-
struct EC_T_BUS_SLAVE_INFO
Public Members
-
EC_T_DWORD adwPortSlaveIds[ESC_PORT_COUNT]
[out] The slave’s ID of the slaves connected to ports. See Port slave ID’s
-
EC_T_WORD wPortState
[out] Port link state. Format: wwww xxxx yyyy zzzz (each nibble : port 3210)
wwww : Signal detected 1=yes, 0=no
xxxx : Loop closed 1=yes, 0=no
yyyy : Link established 1=yes, 0=no
zzzz : Slave connected 1=yes, 0=no (zzzz = logical result of w,x,y)
-
EC_T_WORD wAlStatusCode
[out] AL status code. (Value of slave ESC register 0x0134 during last error acknowledge). This value is reset after a slave state change
-
EC_T_DWORD dwSystemTimeDifference
[out] System time difference. (Value of slave ESC register 0x092C)
-
EC_T_WORD wMbxSupportedProtocols
[out] Supported Mailbox Protocols stored in the EEPROM at offset 0x001C
-
EC_T_WORD wIdentifyData
[out] Last read identification value see EC_T_CFG_SLAVE_INFO.wIdentifyAdo
-
EC_T_DWORD dwSlaveDelay
[out] Delay behind slave [ns]. This value is only valid if a DC configuration is used
-
EC_T_DWORD dwPropagDelay
[out] Propagation delay [ns]. ESC register 0x0928,This value is only valid if a DC configuration is used
-
EC_T_BOOL bIsDeviceEmulation
[out] Slave without Firmware. ESC register 0x0141, enabled by EEPROM offset 0x0000.8.
-
EC_T_WORD wLineCrossedFlags
[out] Combination of Line crossed flags
-
EC_T_DWORD adwPortSlaveIds[ESC_PORT_COUNT]
Port Slave ID’s
Flags EC_LINECROSSED_