Chapter 16 Rotating Knife
© National Instruments Corporation 16-7 NI-Motion User Manual
{
// Check the high-speed capture
status/following error/axis //off status
err = flex_read_axis_status_rtn(boardID,
slaveAxis, &axisStatus);
CheckError;
// Read the communication status register and
check the modal //errors
err = flex_read_csr_rtn(boardID, &csr);
CheckError;
// Check the modal errors
if (csr & NIMC_MODAL_ERROR_MSG)
{
err = csr & NIMC_MODAL_ERROR_MSG;
CheckError;
}
}while (!(axisStatus & NIMC_HIGH_SPEED_CAPTURE_BIT)
&& !(axisStatus & NIMC_FOLLOWING_ERROR_BIT) &&
!(axisStatus & NIMC_AXIS_OFF_BIT));
//Exit on following error/axis off & high-speed
capture
if((axisStatus & NIMC_FOLLOWING_ERROR_BIT) ||
(axisStatus & NIMC_AXIS_OFF_BIT)){
break; //Break out of the for loop
}
// Update the variables for this cycle
synchronizationPosition += cyclePosition;
correctionPoint += cyclePosition;
// Read the captured position
err = flex_read_cap_pos_rtn(boardID, slaveAxis,
&capturedPosition);
CheckError;
// Load the target position for the registration
//(superimposed) move
err = flex_load_target_pos(boardID, slaveAxis,
(synchronizationPosition - capturedPosition),
0xFF);
CheckError;
// Wait until the axis has passed the correction
point before //applying the correction
currentPosition = 0;
while (currentPosition < correctionPoint){
err = flex_read_pos_rtn(boardID, slaveAxis,
¤tPosition);
CheckError;
}
// Start registration move on the slave