Chapter 10
Electronic Gearing and Camming
©
National Instruments Corporation
10-21
// Configure the superimposed move (optional)
// Set to absolute mode
err =
flex_set_op_mode
(boardID, slaveAxis,
NIMC_ABSOLUTE_POSITION);
CheckError;
// Set the maximum velocity
data.doubleData = velocity;
err =
flex_load_move_constraint
(boardID, slaveAxis,
TnimcMoveConstraintVelocity, &data);
CheckError;
// Set the target position
err =
flex_load_target_pos
(boardID, slaveAxis,
targetPos, 0xFF);
CheckError;
// Start the master axis movement
err =
flex_start
(boardID, slaveAxis, 0x0);
CheckError;
// Wait for move to complete
err =
flex_wait_for_move_complete
(boardID,
slaveAxis, 0x1, 20000, 20, &moveComplete);
CheckError;
// Error Handling
//
nimcHandleError; //NIMCCATCHTHIS:
// Disable camming
flex_enable_camming_single_axis
(boardID, slaveAxis,
FALSE, -1.0);
// Clear (delete) the buffer
flex_clear_buffer
(boardID, buffer);
// Check to see if there were any Modal Errors
flex_read_csr_rtn
(boardID, &csr);
if (csr & NIMC_MODAL_ERROR_MSG)
{
do
{
// Get the command ID, resource and the error code of the
modal
//error from the error stack on the board