Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpiCore)  1.26.2
Configuration functions
Collaboration diagram for Configuration functions:

Functions

MLPIRESULT mlpiEthercatSetConfigFiles (const MLPIHANDLE connection, const ULONG interfaceNumber, const WCHAR16 *iniPathFileName, const WCHAR16 *eniPathFileName)
 
MLPIRESULT mlpiEthercatControl (const MLPIHANDLE connection, const ULONG interfaceNumber, const ULONG command, UCHAR *dataIn, const ULONG dataSizeIn, UCHAR *dataOut, const ULONG dataSizeOut, ULONG *dataSizeOutRet)
 
MLPIRESULT mlpiEthercatSetMasterState (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatState state)
 
MLPIRESULT mlpiEthercatSetSlaveState (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const MlpiEthercatState slaveState)
 
MLPIRESULT mlpiEthercatGenerateEsi (const MLPIHANDLE connection, const WCHAR16 *eepromPathFileName, const WCHAR16 *esiPathFileName, const ULONG flags)
 
MLPIRESULT mlpiEthercatStartBusScan (const MLPIHANDLE connection, const ULONG interfaceNumber, const ULONG flags)
 
MLPIRESULT mlpiEthercatSetProcessData (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatProcessDataType pdType, const ULONG offset, UCHAR *data, const ULONG dataSize)
 

Detailed Description

Contains functions to configure the EtherCAT master and its slaves.

Function Documentation

MLPIRESULT mlpiEthercatSetConfigFiles ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const WCHAR16 iniPathFileName,
const WCHAR16 eniPathFileName 
)

This function sets the master configuration (files will be loaded from 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 // Set the master configuration (files will be loaded from 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 = mlpiEthercatSetConfigFiles(connection, interfaceNumber, iniPathFileName, eniPathFileName);
MLPIRESULT mlpiEthercatControl ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const ULONG  command,
UCHAR dataIn,
const ULONG  dataSizeIn,
UCHAR dataOut,
const ULONG  dataSizeOut,
ULONG dataSizeOutRet 
)

This function enables raw data exchange with the EtherCAT master stack.

Attention
It is mainly intended to be used by engineering systems like Bosch Rexroth IndraWorks. In standard use cases please use type specified functions instead.
Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]commandInternal command number.
[in]dataInPointer to input bytes.
[in]dataSizeInNumber of input bytes.
[out]dataOutPointer to output bytes.
[in]dataSizeOutMaximum number of output bytes (size provided by dataSizeOutRet).
[out]dataSizeOutRetNumber of output bytes returned.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // This function should only be used internally.
MLPIRESULT mlpiEthercatSetMasterState ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatState  state 
)

This function sets the a new master state.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]stateNew master state.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Set a new master state.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatState state = MLPI_ETHERCAT_STATE_INIT;
4 MLPIRESULT result = mlpiEthercatSetMasterState(connection, interfaceNumber, state);
MLPIRESULT mlpiEthercatSetSlaveState ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const MlpiEthercatState  slaveState 
)

This function sets a new slave state.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]slaveStateNew slave state.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Set a new slave state.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 MlpiEthercatState slaveState = MLPI_ETHERCAT_STATE_PREOP;
6 MLPIRESULT result = mlpiEthercatSetSlaveState(connection, interfaceNumber, addressType, address, slaveState);
MLPIRESULT mlpiEthercatGenerateEsi ( const MLPIHANDLE  connection,
const WCHAR16 eepromPathFileName,
const WCHAR16 esiPathFileName,
const ULONG  flags 
)

This function generates an EtherCAT Slave Information (Device Description) from an EEPROM image.

Parameters
[in]connectionHandle for multiple connections.
[in]eepromPathFileNamePath and filename of SII image.
[in]esiPathFileNamePath and filename where ESI will be generated.
[in]flagsBehavior of Esi generator. Currently set to zero.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Generate an EtherCAT Slave Information (Device Description) from an EEPROM image.
2 WCHAR16 eepromPathFileName[] = L"/USER/Eeprom.bin";
3 WCHAR16 esiPathFileName[] = L"/USER/Box1.xml";
4 ULONG flags = 0x00;
5 MLPIRESULT result = mlpiEthercatGenerateEsi(connection, eepromPathFileName, esiPathFileName, flags);
MLPIRESULT mlpiEthercatStartBusScan ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const ULONG  flags 
)

This function starts the bus scan procedure of the master.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]flagsFlags specifying the behavior of bus scan (e.g. if serial number should be checked).
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Start the bus scan procedure of the master.
2 ULONG interfaceNumber = 0;
3 ULONG flags = 0;
4 MLPIRESULT result = mlpiEthercatStartBusScan(connection, interfaceNumber, flags);
MLPIRESULT mlpiEthercatSetProcessData ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatProcessDataType  pdType,
const ULONG  offset,
UCHAR data,
const ULONG  dataSize 
)

This function writes byte stream to process data (consistent).

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]pdTypeProcess data type.
[in]offsetByte offset inside process data (where writing starts).
[in]dataPointer to data image where data will be copied from. pbyData has to provide at least ulNumBytes of content.
[in]dataSizeNumber of bytes to be written.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Write byte stream to process data (consistent).
2 ULONG interfaceNumber = 0;
3 MlpiEthercatProcessDataType pdType = MLPI_ETHERCAT_PD_TYPE_INPUTS;
4 ULONG offset = 5;
5 UCHAR data[100] = {0};
6 ULONG dataSize = _countof(data);
7 MLPIRESULT result = mlpiEthercatSetProcessData(connection, interfaceNumber, pdType, offset, data, dataSize);