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

Functions

MLPIRESULT mlpiEthercatSoeRead (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const UCHAR driveNumber, MlpiEthercatSoeElementFlags *elementFlags, const USHORT idn, UCHAR *data, const ULONG dataSize, ULONG *dataSizeRet)
 
MLPIRESULT mlpiEthercatSoeWrite (const MLPIHANDLE connection, const ULONG interfaceNumber, const MlpiEthercatAddressType addressType, const USHORT address, const UCHAR driveNumber, MlpiEthercatSoeElementFlags *elementFlags, const USHORT idn, UCHAR *data, const ULONG dataSize)
 

Detailed Description

Contains functions to communicate with slaves over Servo drive over EtherCAT.

Function Documentation

MLPIRESULT mlpiEthercatSoeRead ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const UCHAR  driveNumber,
MlpiEthercatSoeElementFlags elementFlags,
const USHORT  idn,
UCHAR data,
const ULONG  dataSize,
ULONG dataSizeRet 
)

This function reads Sercos parameters.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]driveNumberNumber of the servo drive to read from.
[in,out]elementFlagsElements requested and afterwards returned.
[in]idnIdentifier for the element to read.
[out]dataRAW data.
[in]dataSizeNumber of bytes in 'data' available to read.
[out]dataSizeRetNumber of bytes used for reading.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the Sercos parameter.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 UCHAR driveNumber = 5;
6 MlpiEthercatSoeElementFlags elementFlags;
7 memset (&elementFlags, 0, sizeof(MlpiEthercatSoeElementFlags));
8 elementFlags.dataState = TRUE;
9 elementFlags.name = FALSE;
10 elementFlags.attribute = TRUE;
11 elementFlags.unit = FALSE;
12 elementFlags.minValue = TRUE;
13 elementFlags.maxValue = FALSE;
14 elementFlags.value = TRUE;
15 elementFlags.defaultValue = TRUE;
16 USHORT idn = 100;
17 UCHAR data[512] = {0};
18 ULONG dataSize = _countof(data);
19 ULONG dataSizeRet = 0;
20 MLPIRESULT result = mlpiEthercatSoeRead(connection, interfaceNumber, addressType, address, driveNumber, &elementFlags, idn, data, dataSize, &dataSizeRet);
MLPIRESULT mlpiEthercatSoeWrite ( const MLPIHANDLE  connection,
const ULONG  interfaceNumber,
const MlpiEthercatAddressType  addressType,
const USHORT  address,
const UCHAR  driveNumber,
MlpiEthercatSoeElementFlags elementFlags,
const USHORT  idn,
UCHAR data,
const ULONG  dataSize 
)

This function writes Sercos parameters.

Parameters
[in]connectionHandle for multiple connections.
[in]interfaceNumberMaster interface number.
[in]addressTypeAddress type.
[in]addressSlave address (depending on addressType).
[in]driveNumberNumber of the servo drive to write on.
[in,out]elementFlagsElements requested and afterwards returned.
[in]idnIdentifier for the element to write.
[in]dataRAW data.
[in]dataSizeNumber of bytes in 'data' available to write.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Write the Sercos parameter.
2 ULONG interfaceNumber = 0;
3 MlpiEthercatAddressType addressType = MLPI_ETHERCAT_AUTO_INCREMENT;
4 USHORT address = 0;
5 UCHAR driveNumber = 5;
6 MlpiEthercatSoeElementFlags elementFlags;
7 memset (&elementFlags, 0, sizeof(MlpiEthercatSoeElementFlags));
8 elementFlags.dataState = TRUE;
9 elementFlags.name = FALSE;
10 elementFlags.attribute = TRUE;
11 elementFlags.unit = FALSE;
12 elementFlags.minValue = TRUE;
13 elementFlags.maxValue = FALSE;
14 elementFlags.value = TRUE;
15 elementFlags.defaultValue = TRUE;
16 USHORT idn = 20;
17 UCHAR data[128] = {0};
18 ULONG dataSize = _countof(data);
19 MLPIRESULT result = mlpiEthercatSoeWrite(connection, interfaceNumber, addressType, address, driveNumber, &elementFlags, idn, data, dataSize);