APIs, concepts, guides, and more

◆ UserLimitConfigSet() [2/2]

void UserLimitConfigSet ( int32_t number,
RSIUserLimitTriggerType triggerType,
RSIAction action,
int32_t actionAxis,
double duration,
bool singleShot )
Description:
UserLimitConfigSet configures a User Limit and enables it.
Parameters
numberIndex of UserLimit (starts with 0)
triggerTypeuse ::RSIUserLimitTriggerType
actionUse ::RSIAction
actionAxisthe number of the Axis where the Action will occur.
durationIn seconds. Resolution of the duration is sample periods (default is 1ms).
singleShotIf true, the User Limit will be disabled after it triggers one time. The default behavior is false when means it will retrigger whenever conditions are met.

Part of the User Limit method group.

Sample Code:
IO: User Limits
/* This sample demonstrates how to configure a user limit triggered by a single digital input.
When the input matches the specified value, the configured output is activated.
Uses simulated IO with user buffer memory for demonstration purposes.
*/
using RSI.RapidCode; // RSI.RapidCode.dotNET;
Console.WriteLine("📜 User Limit: Digital Input One Condition");
// get rmp objects
MotionController controller = MotionController.Get();
try
{
Helpers.CheckErrors(controller);
// configure user limits
controller.UserLimitCountSet(1); // set the amount of user limits to use
controller.InterruptEnableSet(true); // enable user limit interrupts
// create simulated io using user buffer memory
ulong userBufferAddress = controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER, 0);
IOPoint input0 = IOPoint.CreateDigitalInput(controller, userBufferAddress, bitNumber: 0);
IOPoint output0 = IOPoint.CreateDigitalOutput(controller, userBufferAddress, bitNumber: 1);
Helpers.CheckErrors(input0);
Helpers.CheckErrors(output0);
// configure user limit condition
controller.UserLimitConditionSet(
number: 0,
conditionNumber: 0,
logic: RSIUserLimitLogic.RSIUserLimitLogicEQ,
addressOfUInt32: input0.AddressGet(),
userLimitMask: (uint)input0.MaskGet(),
limitValueUInt32: (uint)input0.MaskGet());
// configure user limit settings
controller.UserLimitConfigSet(
number: 0,
triggerType: RSIUserLimitTriggerType.RSIUserLimitTriggerTypeSINGLE_CONDITION,
action: RSIAction.RSIActionNONE,
actionAxis: 0,
duration: 0);
// configure user limit output
controller.UserLimitOutputSet(
number: 0,
andMask: (uint)output0.MaskGet(),
orMask: (uint)output0.MaskGet(),
outputPtr: output0.AddressGet(),
enabled: true);
Console.WriteLine("Waiting for input trigger...");
// verify output is initially off
if (output0.Get())
throw new Exception("ERROR: Output should not be triggered yet");
// set input high (bit 0) - condition met
controller.MemorySet(input0.AddressGet(), 0b0001); // bit 0 is high
// wait for user limit interrupt to confirm trigger
if (controller.InterruptWait(1000) != RSIEventType.RSIEventTypeUSER_LIMIT)
throw new Exception("ERROR: User limit did not trigger when input was high");
// verify output was activated
if (!output0.Get())
throw new Exception("ERROR: Output should be high after user limit triggered");
Console.WriteLine("✓ User limit triggered successfully - input high, output activated");
// cleanup
output0.Set(false);
controller.UserLimitDisable(0);
controller.UserLimitCountSet(0);
Console.WriteLine("\nUser limit digital input one condition complete.");
}
// handle errors as needed
finally
{
controller.Delete(); // dispose
}
uint64_t AddressGet()
Get the Host Address for the I/O point.
void Set(bool state)
Set the state of a Digital Output.
static IOPoint * CreateDigitalInput(Axis *axis, RSIMotorDedicatedIn motorDedicatedInNumber)
Create a Digital Input from an Axis' Dedicated Input bits.
static IOPoint * CreateDigitalOutput(Axis *axis, RSIMotorDedicatedOut motorDedicatedOutNumber)
Create a Digital Output from an Axis' Dedicated Output bits.
bool Get()
Get the state of Digital Input or Output.
int32_t MaskGet()
Get the bit mask for the I/O point.
Represents one specific point: Digital Output, Digital Input, Analog Output, or Analog Input....
Definition rsi.h:11550
RSIControllerAddressType
Used to get firmware address used in User Limits, Recorders, etc.
Definition rsienums.h:405
RSIEventType
Event Types or Status Bits.
Definition rsienums.h:966
RSIUserLimitLogic
Logic options for User Limits.
Definition rsienums.h:646
RSIAction
Action to perform on an Axis.
Definition rsienums.h:1115
RSIUserLimitTriggerType
Trigger types for UserLimits.
Definition rsienums.h:633
Helpers namespace provides utility functions for common tasks in RMP applications.
Definition helpers.h:21
See also
UserLimitConditionSet, UserLimitOutputSet