Chapter 12 Synchronization
© National Instruments Corporation 12-15 NI-Motion User Manual
// Set the axis number
axis = NIMC_AXIS1;
///////////////////////////////
// Route breakpoint 1 to RTSI line 1
err = flex_select_signal (boardID, NIMC_RTSI1
/*destination*/, NIMC_BREAKPOINT1/*source*/);
CheckError;
// Configure Breakpoint
err = flex_configure_breakpoint(boardID, axis,
NIMC_RELATIVE_BREAKPOINT, NIMC_SET_BREAKPOINT, 0);
CheckError;
// Load breakpoint position, which is position where
breakpoint should occur
err = flex_load_pos_bp(boardID, axis,
breakpointPosition, 0xFF);
CheckError;
for(;;){
// Enable the breakpoint on axis 1
err = flex_enable_breakpoint(boardID, axis,
NIMC_TRUE);
CheckError;
do
{
// Check the breakpoint status
err = flex_read_axis_status_rtn(boardID,
axis, &axisStatus);
CheckError;
// Read the communication status register
and check the modal //errors
err = flex_read_csr_rtn(boardID, &csr);
CheckError;
// Check for modal errors
if (csr & NIMC_MODAL_ERROR_MSG)
{
err = csr & NIMC_MODAL_ERROR_MSG;
CheckError;
}
Sleep (10); // Check every 10 ms
}while (!(axisStatus & NIMC_POS_BREAKPOINT_BIT));
// Wait for breakpoint to be triggered
}