GetAxisByIndex
Gets information from an axis.
Syntax
KsError GetAxisByIndex(
int Index,
SlaveStatus* Details,
int* Resolution,
DWORD* InputVariables,
DWORD* OutputVariables
);
Parameters
Index: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Details: pointer to the SlaveStatus structure that receives the axis information.
Resolution: the encoder resolution of the axis.
InputVariables: the input variables available in the PDO data. The table below shows the bit masks of InputVariables.
OutputVariables: the output variables available in the PDO data. The table below shows the bit masks of OutputVariables.
Bit mask for InputVariables
Hexadecimal bit mask | Variable |
---|---|
0x1 | VAR_STATUS_WORD |
0x2 | VAR_ACTUAL_POSITION |
0x4 | VAR_SECOND_ENCODER |
0x8 | VAR_ACTUAL_VELOCITY |
0x10 | VAR_ACTUAL_TORQUE |
0x20 | VAR_TOUCH_PROBE_STATUS |
0x40 | VAR_MOP_DISPLAY |
0x80 | VAR_AXIS_INPUTS |
Bit mask for OutputVariables
Hexadecimal bit mask | Variable |
---|---|
0x1 | VAR_CONTROL_WORD |
0x2 | VAR_TARGET_POSITION |
0x4 | VAR_TARGET_VELOCITY |
0x8 | VAR_TARGET_TORQUE |
0x10 | VAR_TORQUE_OFFSET |
0x20 | VAR_TOUCH_PROBE_CONTROL |
0x40 | VAR_MOP |
0x80 | VAR_AXIS_OUTPUTS |
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
Remarks
Gets the axis and its encoder resolution details. Used after the KINGSTAR Subsystem is started.
Usable EtherCAT states
ecatOP
Example
VOID PrintAxisInformation(INT Index) {
SlaveStatus moduleStatus = { 0 };
int resolution = 0;
KsError nRet = GetAxisByIndex(Index, &moduleStatus, &resolution, NULL, NULL);
AxisState state = axisOffline;
nRet = GetAxisState(Index, &state);
RtPrintf("Device %d %s: Vendor 0x%x, Product 0x%x, Revision 0x%x, Serial 0x%x\n", Index,
moduleStatus.Name, moduleStatus.VendorId, moduleStatus.ProductCode,
moduleStatus.RevisionNumber, moduleStatus.SerialNumber);
RtPrintf("Address: Auto %d, Fixed %d, Alias %d\n", moduleStatus.SlaveId,
moduleStatus.PhysAddress, moduleStatus.AliasAddress);
RtPrintf("PDO: Input len %d, Output len %d, Index offset 0x%x\n", moduleStatus.InputLength,
moduleStatus.OutputLength, moduleStatus.VariableIndexOffset);
RtPrintf("State %d, Cycle time %d\n", moduleStatus.State, moduleStatus.CycleTime);
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksapi.h | ksapi.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also