Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpiCore)  1.26.2
EtherCAT information
Collaboration diagram for EtherCAT information:

Functions

MLPIRESULT mlpiEthercatGetTopologyStatus (const MLPIHANDLE connection, const ULONG interfaceNumber, MlpiEthercatTopologyStatus *topologyStatus, ULONG *numChanges)
 
MLPIRESULT mlpiEthercatGetConfigFiles (const MLPIHANDLE connection, const ULONG interfaceNumber, const WCHAR16 *iniPathFileName, const WCHAR16 *eniPathFileName)
 
MLPIRESULT mlpiEthercatGetMasterState (const MLPIHANDLE connection, const ULONG interfaceNumber, MlpiEthercatState *state)
 
MLPIRESULT mlpiEthercatGetMasterStatus (const MLPIHANDLE connection, const ULONG interfaceNumber, ULONG *status)
 
MLPIRESULT mlpiEthercatGetNumConfiguredSlaves (const MLPIHANDLE connection, const ULONG interfaceNumber, ULONG *numSlaves)
 
MLPIRESULT mlpiEthercatGetNumConnectedSlaves (const MLPIHANDLE connection, const ULONG interfaceNumber, ULONG *numSlaves)
 
MLPIRESULT mlpiEthercatGetSlaveState (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, USHORT *currentState, USHORT *requestedState)
 
MLPIRESULT mlpiEthercatGetSlaveStatus (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, ULONG *status)
 
MLPIRESULT mlpiEthercatGetSlaveOnlineInfo (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, MlpiEthercatSlaveOnlineInfo *slaveOnlineInfo)
 
MLPIRESULT mlpiEthercatGetSlaveConfigInfo (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, MlpiEthercatSlaveConfigInfo *slaveConfigInfo)
 
MLPIRESULT mlpiEthercatGetVendorInfo (const MLPIHANDLE connection, const ULONG vendorId, MlpiEthercatVendorInfo *vendorInfo)
 
MLPIRESULT mlpiEthercatGetBusScanStatus (const MLPIHANDLE connection, const ULONG interfaceNumber, MLPIRESULT *status, ULONG *slaveCount)
 
MLPIRESULT mlpiEthercatGetBusScanSlaveInfo (const MLPIHANDLE connection, const ULONG interfaceNumber, const USHORT autoIncAddr, MlpiEthercatSlaveBusScanInfo *slaveBusScanInfo, const ULONG numElements, ULONG *numElementsRet)
 
MLPIRESULT mlpiEthercatGetProcessData (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatProcessDataType pdType, const ULONG offset, UCHAR *data, const ULONG dataSize, ULONG *dataSizeRet)
 
MLPIRESULT mlpiEthercatGetProcessDataSize (const MLPIHANDLE connection, const ULONG interfaceNumber, ULONG *numOutputBytes, ULONG *numInputBytes)
 

Detailed Description

Contains functions to read information of the EtherCAT master and its slaves.

Function Documentation

MLPIRESULT mlpiEthercatGetTopologyStatus ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
MlpiEthercatTopologyStatus topologyStatus,
ULONG numChanges 
)

This function returns the status of topology detection.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]topologyStatusStatus of topology detection.
[out]numChangesNumber of topology changes (incremented each time a topology change event occurs).
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Return the status of topology detection.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatTopologyStatus topologyStatus = MLPI_ETHERCAT_TOPOLOGY_STATUS_UNKNOWN;
4 ULONG numChanges = 0;
5 MLPIRESULT result = mlpiEthercatGetTopologyStatus(connection, interfaceNumber, &topologyStatus, &numChanges);
MLPIRESULT mlpiEthercatGetConfigFiles ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const WCHAR16 iniPathFileName,
const WCHAR16 eniPathFileName 
)

This function returns the master configuration (files will be stored on local drive of control).

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]iniPathFileNamePath and filename of master configuration file (Bosch Rexroth specific).
[in]eniPathFileNamePath and filename of EtherCAT network information file.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Return the master configuration (files will be stored on local drive of control).
2 ULONG interfaceNumber = 0;
3 WCHAR16 iniPathFileName[] = L"/USER/EtherCAT.ini";
4 WCHAR16 eniPathFileName[] = L"/USER/EtherCAT.xml";
5 MLPIRESULT result = mlpiEthercatGetConfigFiles(connection, interfaceNumber, iniPathFileName, eniPathFileName);
MLPIRESULT mlpiEthercatGetMasterState ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
MlpiEthercatState state 
)

This function returns the current master state.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]stateCurrent master state.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the current master state.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatState state = MLPI_ETHERCAT_STATE_UNKNOWN;
4 MLPIRESULT result = mlpiEthercatGetMasterState(connection, interfaceNumber, &state);
MLPIRESULT mlpiEthercatGetMasterStatus ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
ULONG status 
)

This function returns the master status.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]statusMaster status.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the master status.
2 ULONG interfaceNumber = 0;
3 ULONG status = 0;
4 MLPIRESULT result = mlpiEthercatGetMasterStatus(connection, interfaceNumber, &status);
MLPIRESULT mlpiEthercatGetNumConfiguredSlaves ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
ULONG numSlaves 
)

This function returns the number of configured slaves.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]numSlavesNumber of configured slaves.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the number of configured slaves.
2 ULONG interfaceNumber = 0;
3 ULONG numSlaves = 0;
4 MLPIRESULT result = mlpiEthercatGetNumConfiguredSlaves(connection, interfaceNumber, &numSlaves);
MLPIRESULT mlpiEthercatGetNumConnectedSlaves ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
ULONG numSlaves 
)

This function returns the number of connected slaves.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]numSlavesNumber of connected slaves.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the number of connected slaves.
2 ULONG interfaceNumber = 0;
3 ULONG numSlaves = 0;
4 MLPIRESULT result = mlpiEthercatGetNumConnectedSlaves(connection, interfaceNumber, &numSlaves);
MLPIRESULT mlpiEthercatGetSlaveState ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
USHORT currentState,
USHORT requestedState 
)

This function returns the current and requested slave state.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[out]currentStateCurrent slave state.
[out]requestedStateRequested slave state.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the current and requested slave state.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 USHORT currentState = 0;
6 USHORT requestedState = 0;
7 MLPIRESULT result = mlpiEthercatGetSlaveState(connection, interfaceNumber, addressType, address, &currentState, &requestedState);
MLPIRESULT mlpiEthercatGetSlaveStatus ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
ULONG status 
)

This function returns the slave status.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[out]statusSlave status.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the slave status.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 ULONG status = 0;
6 MLPIRESULT result = mlpiEthercatGetSlaveStatus(connection, interfaceNumber, addressType, address, &status);
MLPIRESULT mlpiEthercatGetSlaveOnlineInfo ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
MlpiEthercatSlaveOnlineInfo slaveOnlineInfo 
)

This function returns information about a slave connected to the EtherCAT bus.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[out]slaveOnlineInfoSlave online information.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get information about a slave connected to the EtherCAT bus.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 MlpiEthercatSlaveOnlineInfo slaveOnlineInfo;
6 memset (&slaveOnlineInfo, 0, sizeof(MlpiEthercatSlaveOnlineInfo));
7 MLPIRESULT result = mlpiEthercatGetSlaveOnlineInfo(connection, interfaceNumber, addressType, address, &slaveOnlineInfo);
MLPIRESULT mlpiEthercatGetSlaveConfigInfo ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
MlpiEthercatSlaveConfigInfo slaveConfigInfo 
)

This function returns information about a slave configured within the ENI file.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[out]slaveConfigInfoSlave configuration information.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get information about a slave configured within the ENI file.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 MlpiEthercatSlaveConfigInfo slaveConfigInfo;
6 memset (&slaveConfigInfo, 0, sizeof(MlpiEthercatSlaveConfigInfo));
7 MLPIRESULT result = mlpiEthercatGetSlaveConfigInfo(connection, interfaceNumber, addressType, address, &slaveConfigInfo);
MLPIRESULT mlpiEthercatGetVendorInfo ( const MLPIHANDLE  connection,
const ULONG  vendorId,
MlpiEthercatVendorInfo vendorInfo 
)

This function returns the vendor information which is connected to a specific vendor id.

Parameters
[in]connectionHandle for multiple connections.
[in]vendorIdEtherCAT vendor id.
[out]vendorInfoVendor information.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the vendor information which is connected to a specific vendor id.
2 ULONG vendorId = 1;
3 MlpiEthercatVendorInfo vendorInfo;
4 MLPIRESULT result = mlpiEthercatGetVendorInfo(connection, vendorId, &vendorInfo);
MLPIRESULT mlpiEthercatGetBusScanStatus ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
MLPIRESULT status,
ULONG slaveCount 
)

This function returns the status of the bus scan.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]statusStatus indicating if bus scan has been executed or not.
[out]slaveCountNumber of connected slaves (in case of executed bus scan).
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Return the status of the bus scan.
2 ULONG interfaceNumber = 0;
3 MLPIRESULT status = 0;
4 ULONG slaveCount = 0;
5 MLPIRESULT result = mlpiEthercatGetBusScanStatus(connection, interfaceNumber, &status, &slaveCount);
MLPIRESULT mlpiEthercatGetBusScanSlaveInfo ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const USHORT  autoIncAddr,
MlpiEthercatSlaveBusScanInfo slaveBusScanInfo,
const ULONG  numElements,
ULONG numElementsRet 
)

This function returns the slave information collected during bus scan.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]autoIncAddrAuto increment address from which on slave infos should be returned.
[out]slaveBusScanInfoPointer to slave infos.
[in]numElementsNumber of elements provided by slaveBusScanInfo.
[out]numElementsRetNumber of elements written to slaveBusScanInfo.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Return the slave information collected during bus scan.
2 ULONG interfaceNumber = 0;
3 USHORT autoIncAddr = 5;
4 ULONG numElements = 128;
5 MlpiEthercatSlaveBusScanInfo slaveBusScanInfo[numElements];
6 ULONG numElementsRet = 0;
7 MLPIRESULT result = mlpiEthercatGetBusScanSlaveInfo(connection, interfaceNumber, autoIncAddr, slaveBusScanInfo, numElements, &numElementsRet);
MLPIRESULT mlpiEthercatGetProcessData ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatProcessDataType  pdType,
const ULONG  offset,
UCHAR data,
const ULONG  dataSize,
ULONG dataSizeRet 
)

This function reads process data (consistent) and returns them as byte stream.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]pdTypeProcess data type.
[in]offsetByte offset inside process data (where reading starts).
[out]dataPointer to data image where data will be copied to. pbyData has to provide at least ulNumBytes of space.
[in]dataSizeNumber of bytes to be read.
[out]dataSizeRetNumber of bytes used.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read process data (consistent) and returns them as byte stream.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatProcessDataType pdType = MLPI_ETHERCAT_PD_TYPE_INPUTS;
4 ULONG offset = 2;
5 UCHAR data[100] = {0};
6 ULONG dataSize = _countof(data);
7 ULONG dataSizeRet = 0;
8 MLPIRESULT result = mlpiEthercatGetProcessData(connection, interfaceNumber, pdType, offset, data, dataSize, &dataSizeRet);
MLPIRESULT mlpiEthercatGetProcessDataSize ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
ULONG numOutputBytes,
ULONG numInputBytes 
)

This function returns the size of the current process data image, e.g. use for diagnosis purpose.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[out]numOutputBytesSize of output image in bytes.
[out]numInputBytesSize of image image in bytes.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the size of the current process data image, e.g. use for diagnosis purpose.
2 ULONG interfaceNumber = 0;
3 ULONG numOutputBytes = 0;
4 ULONG numInputBytes = 0;
5 MLPIRESULT result = mlpiEthercatGetProcessDataSize(connection, interfaceNumber, &numOutputBytes, &numInputBytes);