◆ UserUnitsSet()

virtual void UserUnitsSet ( double  countsPerUserUnit)
pure virtual

Sets the number of counts per User Unit.

ℹ This function is avaliable in RapidCode and RapidSequencer

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:
SetUserUnits
// Constants
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)
double USER_UNITS = Math.Pow(2, ENCODER_RESOLUTION_BITS); //1048576 Setting the user units to this value will result in a commanded position of 1 spinning the motor 1 full revolution
axis.UserUnitsSet(USER_UNITS); // SET YOUR USER UNITS!
axis.ErrorLimitTriggerValueSet(1); // Specify the position error limit trigger. (Learn more about this on our support page)
//---ASSERT---
Assert.That(axis.UserUnitsGet(), Is.EqualTo(USER_UNITS)); // Verify that your user units were changed!
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.
Axis_Motion_Profile_and_Parameters.jpg
See also
UserUnitsGet
Examples
MotionHoldReleasedBySoftwareAddress.cpp, PVTmotionMultiAxis.cpp, SingleAxisSyncOutputs.cpp, SyncOutputWithMotion.cpp, and UpdateBufferPoints.cpp.