APIs, concepts, guides, and more

◆ UserUnitsSet()

void UserUnitsSet ( double countsPerUserUnit)
Description:
Allows you to change your default units from encoder counts to some other unit by supplying the number of encoder counts in said "User Unit."
Parameters
countsPerUserUnitThe number of Encoder Counts in desired User Unit
Sample Code:
Axis: Configuration
const int ENCODER_RESOLUTION_BITS = 20; // The number of bits defining the encoder resolution
// Specify your counts per unit/user units. (the motor used in this sample app has 1048576 encoder pulses per revolution)
// 1048576 Setting the user units to this value will result in a commanded position of 1 spinning the motor 1 full revolution
double USER_UNITS = Math.Pow(2, ENCODER_RESOLUTION_BITS);
// SET
axis.UserUnitsSet(USER_UNITS);
axis.ErrorLimitTriggerValueSet(1); // Specify the position error limit trigger. (Learn more about this on our support page)
// GET
var userUnits = axis.UserUnitsGet();
RapidSetup:
Go to axis screen->Motion and Tuning. In the image below, UserUnitsSet sets the value in the Counts per Unit box shown in the Motion Parameters box. It is currently set to 1 which means units are in counts.
See also
UserUnitsGet
Examples
AxisConfig.cs, AxisConfiguration.cpp, HelperFunctions.cs, MathBlock.cs, MotionHoldReleasedBySoftwareAddress.cpp, MultiaxisMotion.cpp, PVTmotionMultiAxis.cpp, PathMotion.cpp, SingleAxisSyncOutputs.cpp, SyncOutputWithMotion.cpp, Template.cs, UpdateBufferPoints.cpp, and VelocitySetByAnalogInputValue.cs.