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
int ENCODER_RESOLUTION_BITS = 20; // Encoder resolution in bits
// Define counts per unit (user units)
// Example: 2^20 = 1,048,576 pulses/rev → a command of 1 = one full revolution
double USER_UNITS = Math.Pow(2, ENCODER_RESOLUTION_BITS);
// set
axis.UserUnitsSet(USER_UNITS);
axis.ErrorLimitTriggerValueSet(1); // Position error limit trigger (see support page)
// get
double 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
AxisConfiguration.cpp, MotionHoldReleasedBySoftwareAddress.cpp, MultiaxisMotion.cpp, PVTmotionMultiAxis.cpp, PathMotion.cpp, SingleAxisSyncOutputs.cpp, SyncOutputWithMotion.cpp, UpdateBufferPoints.cpp, _helpers.cs, _setup.cs, axis-config-userunits.cs, and basic-template.cs.