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

Functions

MLPIRESULT mlpiEthercatCoeGetOdList (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const MlpiEthercatOdListType listType, USHORT *indicies, const ULONG numElements, ULONG *numElementsRet)
 
MLPIRESULT mlpiEthercatCoeGetObjectDescription (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const USHORT objectIndex, UCHAR *data, const ULONG dataSize, ULONG *dataSizeRet)
 
MLPIRESULT mlpiEthercatCoeGetEntryDescription (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const USHORT objectIndex, const UCHAR subIndex, const UCHAR valueInfo, UCHAR *data, const ULONG dataSize, ULONG *dataSizeRet)
 
MLPIRESULT mlpiEthercatCoeSdoUpload (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const USHORT objectIndex, const UCHAR subIndex, const ULONG flags, UCHAR *data, const ULONG dataSize, ULONG *dataSizeRet)
 
MLPIRESULT mlpiEthercatCoeSdoDownload (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const USHORT objectIndex, const UCHAR subIndex, const ULONG flags, UCHAR *data, const ULONG dataSize)
 

Detailed Description

Contains functions to communicate with slaves over CANopen application protocol over EtherCAT.

Function Documentation

MLPIRESULT mlpiEthercatCoeGetOdList ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const MlpiEthercatOdListType  listType,
USHORT indicies,
const ULONG  numElements,
ULONG numElementsRet 
)

This function gets a list of object indices which are available in a EtherCAT CoE device.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]listTypeList type.
[out]indiciesData buffer for object list.
[in]numElementsNumber of elements in 'indicies' available to read.
[out]numElementsRetNumber of elements used.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get a list of object indices which are available in a EtherCAT CoE device.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 MlpiEthercatOdListType listType = MLPI_ETHERCAT_OD_LIST_TYPE_ALL;
6 USHORT indicies[30] = {0};
7 ULONG numElements = _countof(indicies);
8 ULONG numElementsRet = 0;
9 MLPIRESULT result = mlpiEthercatCoeGetOdList(connection, interfaceNumber, addressType, address, listType, indicies, numElements, &numElementsRet);
MLPIRESULT mlpiEthercatCoeGetObjectDescription ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const USHORT  objectIndex,
UCHAR data,
const ULONG  dataSize,
ULONG dataSizeRet 
)

This function gets the object description for a specific object (SDO) in EtherCAT CoE device.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]objectIndexObject index.
[out]dataData buffer for object description (see ETG 1000 specification).
[in]dataSizeSize of buffer provided by data in bytes.
[out]dataSizeRetSize of data written to data in bytes.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the object description for a specific object (SDO) in EtherCAT CoE device.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 USHORT objectIndex = 0;
6 UCHAR data[1024] = {0};
7 ULONG dataSize = _countof(data);
8 ULONG dataSizeRet = 0;
9 MLPIRESULT result = mlpiEthercatCoeGetObjectDescription(connection, interfaceNumber, addressType, address, objectIndex, data, dataSize, &dataSizeRet);
MLPIRESULT mlpiEthercatCoeGetEntryDescription ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const USHORT  objectIndex,
const UCHAR  subIndex,
const UCHAR  valueInfo,
UCHAR data,
const ULONG  dataSize,
ULONG dataSizeRet 
)

This function gets the object entry description for a specific object (SDO) in EtherCAT CoE device.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]objectIndexObject index.
[in]subIndexSub index.
[in]valueInfoBit mask to define which information to determine (see ETG 1000 specification).
[out]dataData buffer for entry description (see ETG 1000 specification).
[in]dataSizeSize of buffer provided by data in bytes.
[out]dataSizeRetSize of data written to data in bytes.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Get the object entry description for a specific object (SDO) in EtherCAT CoE device.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 USHORT objectIndex = 0;
6 UCHAR subIndex = 0;
7 UCHAR valueInfo = 20;
8 UCHAR data[1024] = {0};
9 ULONG dataSize = _countof(data);
10 ULONG dataSizeRet = 0;
11 MLPIRESULT result = mlpiEthercatCoeGetObjectDescription(connection, interfaceNumber, addressType, address, objectIndex, subIndex, valueInfo, data, dataSize, &dataSizeRet);
MLPIRESULT mlpiEthercatCoeSdoUpload ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const USHORT  objectIndex,
const UCHAR  subIndex,
const ULONG  flags,
UCHAR data,
const ULONG  dataSize,
ULONG dataSizeRet 
)

This function performs a CoE SDO upload from an EtherCAT slave device to the master.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]objectIndexObject index.
[in]subIndexSub index.
[in]flagsMailbox flags specifying the upload behavior. Bit 0: Complete Access, Bit 1-31: Reserved (see ETG 1000.6 specification).
[out]dataData buffer for uploaded data.
[in]dataSizeNumber of bytes in 'data' available to upload.
[out]dataSizeRetNumber of bytes used for upload.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Perform a CoE SDO upload from an EtherCAT slave device to the master.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 USHORT objectIndex = 4;
6 UCHAR subIndex = 0;
7 ULONG flags = 0;
8 UCHAR data[1024] = {0};
9 ULONG dataSize = _countof(data);
10 ULONG dataSizeRet = 0;
11 for (subIndex = 1; subIndex <= 4; subIndex++)
12 {
13  result = mlpiEthercatCoeSdoUpload(connection, interfaceNumber, addressType, address, objectIndex, subIndex, flags, data, dataSize, &dataSizeRet);
14 }
MLPIRESULT mlpiEthercatCoeSdoDownload ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const USHORT  objectIndex,
const UCHAR  subIndex,
const ULONG  flags,
UCHAR data,
const ULONG  dataSize 
)

This function performs a CoE SDO download from the master to an EtherCAT slave device.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]objectIndexObject index.
[in]subIndexSub index.
[in]flagsMailbox flags specifying the upload behavior. Bit 0: Complete Access, Bit 1-31: Reserved (see ETG 1000.6 specification).
[in]dataData to be transferred.
[in]dataSizeNumber of bytes in 'data' available to download.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Perform a CoE SDO download from the master to an EtherCAT slave device.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 USHORT objectIndex = 0x4000;
6 UCHAR subIndex = 5;
7 ULONG flags = 0;
8 UCHAR data[1024] = {0};
9 ULONG dataSize = _countof(data);
10 MLPIRESULT result = mlpiEthercatCoeSdoDownload(connection, interfaceNumber, addressType, address, objectIndex, subIndex, flags, data, dataSize);