SetAxisSecondEncoderCountsPerUnit
Sets the conversion ratio of the user-defined position unit to the count (pulse) unit used by an axis for the secondary encoder.
Syntax
KsError SetAxisSecondEncoderCountsPerUnit(
int Index,
double Numerator,
double Denominator,
BOOL Reverse
);
Parameters
Index: the index of an axis. Indexes are zero based. Aliases affect this parameter.
Numerator: converts the drive unit to the user unit. For example, if the device is an encoder, typically the numerator is the resolution of the encoder.
Denominator: converts the drive unit to the user unit. For example, if you're using degree, the denominator will be 360 since there are 360 degrees in one revolution.
The following is an example of unit conversion:
angle: the angle you want.
resolution: the encoder resolution.
360: the degrees in a revolution.
position: the position.
Reverse: reverses the direction of the axis.
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
- Used to replace the count unit of the axis with a user unit. This function can only be used when the axis is disabled.
- After sending this function, you need to use EnableAxisUnitConversion so your unit takes effect.
Example
N/A
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksmotion.h | ksmotion.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also