Error regarding protected memory during API calls

When INtime and my application software start for the first time, and under this condition we execute the touch probe routine, issuing a velocity move command like axis2.MoveVelocity(-0.5, 20.0), we encounter the following error:


In this condition when we restart our software without restarting INtime, and run the same routine again the error vanishes. Can someone shed some light on why something like this could occur?

This is the routine for the touch probe. Note that the error is always observed for the API call done inside the “try” block only. Also note that when we restart the application software alone after the error has occured, and run the same routine, we do not get the error.

axis2.MoveSCurve(0);
axis2.MotionDoneWait();
axis0.MoveSCurve(X, 10, 20, 20, 50);
axis1.MoveSCurve(Y, 10, 20, 20, 50);

axis0.MotionDoneWait();
axis1.MotionDoneWait();

// Some Necessary Pre User Limit Configuration
controller.AxisCountSet(3);
controller.UserLimitCountSet(1); // Set the amount of UserLimits that you want to use.
controller.InterruptEnableSet(true); // Enable User Limit Interrupts. (When a user limit input comparison is met, and interrupt is triggered)
try
{
multi.MotionDoneWait();
axis2.MoveVelocity(-0.5, 20.0); // Command a velocity move (Velocity=1.0, Acceleration=10.0).
ulong address = input0.AddressGet();
uint mask = (uint)input0.MaskGet();

// USER LIMIT CONDITION
controller.UserLimitConditionSet(USER_LIMIT, CONDITION, LOGIC, input0.AddressGet(), (uint)input0.MaskGet(), LIMIT_VALUE); // Set your User Limit Condition (1st step to setting up your user limit)

// USER LIMIT CONFIGURATION
controller.UserLimitConfigSet(USER_LIMIT, TRIGGER_TYPE, ACTION, AXIS_INDEX, DURATION);                                    // Set your User Limit Configuration. (2nd step to setting up your user limit)

// USER LIMIT USER DATA SET
controller.UserLimitInterruptUserDataAddressSet(USER_LIMIT,                                                               // Specify the user limit you want to add User Data for.
                                                USER_DATA_INDEX,                                                          // Specify what user data index you would like to use. (must be a value from 0 to 4)
                                                axis2.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeACTUAL_POSITION));  // Specify the address of the data value you want to store in your User Data so that you can retrieve it later after the UserLimit limit triggers.

// WAIT FOR DIGITAL INPUT TO TRIGGER USER LIMIT EVENT.
while (controller.InterruptWait(1) != RSIEventType.RSIEventTypeUSER_LIMIT)        // Wait until your user limit triggers.
{
    controller.MemorySet(input0.AddressGet(), 1);
}

int triggeredUserLimit = controller.InterruptSourceNumberGet() - AXIS_COUNT;        // Check that the correct user limit has triggered. (an extra user limit is allocated for each axis)
double interruptPosition = controller.InterruptUserDataDoubleGet(USER_DATA_INDEX);  // Get the data stored in the interrupt's user data you configured.

Hi @RK_8323,

Handle invalid makes me think that your Rapidcode object is invalid. Base on it only failing once, I bet you have created a RapidCode object then later reallocated objects. (AxisCountSet, MotionCountSet, UserLimitCountSet, RecorderCountSet etc). On your next run, your object is valid, but the Set function doesn’t need to reallocate memory for the new object count.

See if you are using any of the following after creating any Rapidcode object other than the MotionController: