◆ MotionHoldTypeSet()

virtual void MotionHoldTypeSet ( RSIMotionHoldType  type)
pure virtual

Set the motion hold type.

ℹ This function is avaliable in RapidCode and RapidSequencer

Part of the Motion Configuration method group.

MotionHoldTypeSet sets the motion hold type.
typeUse RSIMotionAttrHoldType.
Sample Code:
// Constants
const int DIGITAL_INPUTS_PDO_INDEX = 3; // Specify the pdo inputs index that represent digital inputs.
ulong inputAddress = controller.NetworkInputAddressGet(DIGITAL_INPUTS_PDO_INDEX); // Get host address using the PDO Input Index of Digital Inputs.
axis.MotionHoldTypeSet(RSIMotionHoldType.RSIMotionHoldTypeCUSTOM); // Use TypeCUSTOM to hold execution based on a particular bit turning ON or OFF.
axis.MotionHoldUserAddressSet(inputAddress); // Specify the digital inputs host address. This address' value will be used to evaluate the motion hold condition.
axis.MotionHoldUserMaskSet(0x20000); // Specify the bit you want to mask/watch from the MotionHoldUserAddressSet' address value (this evaluates using a logic AND)
axis.MotionHoldUserPatternSet(0x20000); // Specify the bit value that will release the motion hold. (When this value is met, motion hold will be released)
axis.MotionAttributeMaskOnSet(RSIMotionAttrMask.RSIMotionAttrMaskHOLD); // Set the HOLD motion attribute mask ON. (This initializes the HOLD on a particular motion)
axis.MoveRelative(10); // Command simple relative motion. (This motion will be HOLD by the condition above)
axis.MotionDoneWait(); // Wait for Motion to be completed.
axis.MoveRelative(10); // If motion attribute mask off has not been set, this motion will have same HOLD condition as previous move.
axis.MotionDoneWait(); // Wait for Motion to be completed.
axis.MotionAttributeMaskOffSet(RSIMotionAttrMask.RSIMotionAttrMaskHOLD);// Set the HOLD motion attribute mask OFF. (This will clear any motion HOLDS that were set on this Axis)
axis.MoveRelative(10); // This motion will have no HOLD since the previous line has set the motion attribute mask OFF.
axis.MotionDoneWait(); // Wait for Motion to be completed.
// Abort and Clear Faults
To hold execution of motion, you can use Motion Hold.

If you need to hold execution based on a particular bit turning ON or OFF, use RSIMotionAttrHoldTypeUSER_ADDRESS. With RSIMotionAttrHoldTypeUSER_ADDRESS, the logic in the MotionController firmware goes something like this:

andResult = ( userAddressValue & mask);
if (andResult == pattern)

If using RSIMotionAttrHoldTypeUSER_ADDRESS or GATE, be sure to set RSIMotionAttrMaskHOLD before starting motion.

If using RSIMotionAttrHoldTypeAXIS_POSITION_COMMAND be sure to set RSIMotionAttrMaskHOLD or LESS before starting motion.

See also