National Instruments NI-Motion User Manual
Page 170

Chapter 12
Synchronization
12-20
ni.com
CheckError;
printf("\n");
do
{
//Read the axis status
err =
flex_read_axis_status_rtn
(boardID,axis,&axisStat
us);
CheckError;
err =
flex_read_pos_rtn
(boardID,axis,¤tPos);
CheckError;
//Check the breakpoint bit
bpStatus = !((axisStatus &
NIMC_POS_BREAKPOINT_BIT)==0);
//Check the profile complete bit
profileStatus = !((axisStatus &
NIMC_PROFILE_COMPLETE_BIT)==0);
printf("Current Position=%10d Breakpoint
Status=%d Profile
Complete=%d\r",currentPos,bpStatus,profileStatus
);
//Check for modal errors
err = flex_read_csr_rtn(boardID,&csr);
CheckError;
//Check the modal errors
if
(csr & NIMC_MODAL_ERROR_MSG)
{
flex_stop_motion
(boardID,NIMC_VECTOR_SPA
CE1, NIMC_DECEL_STOP, 0);//Stop the
Motion
err = csr & NIMC_MODAL_ERROR_MSG;
CheckError;
}
}while(!profileStatus);
printf("\nFinished.\n");
return
; // Exit the Application
///////////////////////////////////////////////////
//////////////////////
// Error Handling
//