GetAxisState
Gets the state of the selected axis.
Syntax
KsError GetAxisState(
int Index,
AxisState* State
);
Parameters
Index [in]: the index of an axis. Indexes are zero based. Aliases affect this parameter.
State [out]: pointer to the AxisState type that shows the axis' state.
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
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 | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also