User Limits

What are User Limits?

User Limits are a functionality through which user can configure a comparison between inputs, so when the comparison happens an output or an interrupt can be triggered.
A User Limit will evaluate conditions set by the user. These conditions will be processed in the firmware of the RMP. When these conditions are met, the User Limit will generate an interrupt and can also output 32-bit word to any location in the MotionController firmware.
Each User Limit supports up to two input conditions and one output configuration block.

When to Use User Limits?

User Limits are best suited for real-time logic processing that must happen in RMP firmware, not the user application.
  1. 1.
    When you want to generate an action based on a digital input state change.
  2. 2.
    When you want to generate an action based on two different input state changes.
  3. 3.
    When you want to generate an action based on a specific encoder/axis position.
  4. 4.
    When you want to trigger a digital output when an Axis’ Actual Position is exceeded.

Output Actions

  • Axis ESTOP
  • Axis STOP
  • Axis ABORT
  • Digital Output State Change
  • Proportional Gain Change
  • Monitor Different Variables

RapidCode API Usage


UserLimitConditionSet(int number, int conditionNumber, RSIUserLimitLogic logic, ulong address, int mask, int limitValue)
int number
Enter the user limit number that will be used. Starts from 0 and goes to (UserLimitCountGet – 1).
int conditionNumber
Enter 0 or 1 to define the number of input conditions to be processed. Maximum of two input conditions can be combined with AND or OR logic. ConditionNumber would be set to 0 to compare one input bit. ConditionNumber would be set to 1 to compare two input bits.
RSIUserLimitLogic logic
Represents logic that user will need to select to select how an input value is compared. See Enumerations below for valid options. Ex: user wants to compare an actual position to see when actual position is greater than 2000 counts. User would have to enter RSIUserLimitLogicGT
ulong address
User needs to enter the address of the input. User can call Axis.AddressGet(), MotionController.AddressGet(), or MotionController.NetworkInputAddressGet() to get the address of a particular input.
int mask
Decide the bits in an address which need to be used when comparing. Use 0xFFFFFFFF when all bits should be considered. (* only applicable when the Condition’s DataType is a 32-bit integer or bitmask)
int limitValue
The value to be compared which needs to be set here.
  1. 1.
    This method should be called first. UserLimitConditionSet() configures user limits to evaluate an input bit. It sets a condition for when the user limit should trigger.
  2. 2.
    To track more complex input bit addresses, user can get the address from VM3 or contact us.
A user wants to compare the input condition of only a single axis position. If user intends on tracking two input conditions, call the function twice using 0 for the first condition and 1 for the 2nd condition.
If the user wants the User Limit to trigger when axis-0 position is greater than 2000 counts, then 2000 would be the limitValue.
For a Digital Input Slice I/O, if the 4th bit is changing then the user would simply enter: 0x00010000.


UserLimitConfigSet(int number, RSIUserLimitTriggerType triggerType, RSIAction action, int actionAxis, double duration)
int number
Enter the user limit number that you are setting up. Starts from 0 and goes to (UserLimitCountGet – 1).
RSIUserLimitTriggerType triggerType
Choose the how the condition(s) should be evaluated.
RSIAction action
Choose the action you want to cause when the User Limit triggers.
int actionAxis
Select the axis that the action (defined above) will occur on.
double duration
Enter the time delay (in seconds) before the action is executed after the User Limit has triggered. Resolution of the duration is sample periods (default is 1ms).
Call this method after UserLimitConditionSet(). This method configures a User Limit and enables it.


UserLimitOutputSet(int number, int andMask, int orMask, ulong outputPtr, bool enabled)
int number
Enter the user limit number that you want to configure to trigger an output. Starts from 0 and goes to (UserLimitCountGet – 1).
int andMask
This is a 32-bit AND mask. andMask is always computed before orMask. Bit mask will be AND-ed with the data pointed by the ulong outputPtr.
int orMask
This is a 32-bit OR mask. Bit mask will be OR-ed with the result of (andMask & outputPtr).
ulong outputPtr
Pointer to any location in the motion controller firmware. This is a host address, like the values returned from AddressGet(...) methods.
bool enabled
If TRUE, the output AND-ing and OR-ing will be executed when the User Limit triggers.
Call this method after UserLimitConfigSet(), but only if you want to configure an output to be triggered. The output will only be triggered when the User Limit is triggered.

Other User Limit Info

  • It is important to know that our API reserves a user limit per every one axis.
  • The RMP controller has up to 2048 User Limit objects.
  • UserLimitCountSet should be done after either setting AxisCountSet and/or starting the network. (Internally, RapidCode Axis objects use UserLimits.) UserLimitCountSet must be called before creating an Axis or MultiAxis object with MotionController::AxisGet() or MotionController::MultiAxisGet().
  • User Limits are “zero” ordinate when accessing them.


Are User Limits monitored cyclically like PLC?
Yes, User Limit objects are running inside the real-time motion firmware and they are cyclic (processed every cycle).

User Limits Sample Apps