Chapter 12
Synchronization
©
National Instruments Corporation
12-11
///////////////////////////////
//
Set the board ID
boardID = 1;
//
Set the axis number
axis = NIMC_AXIS1;
////////////////////////////////
//
Route breakpoint 1 to RTSI line 1
err =
flex_select_signal
(boardID, NIMC_RTSI0
/*destination*/, NIMC_BREAKPOINT1/*source*/);
CheckError;
//
Configure the breakpoint
err =
flex_configure_breakpoint
(boardID, axis,
NIMC_ABSOLUTE_BREAKPOINT /*mode*/,
NIMC_SET_BREAKPOINT /*action*/,
NIMC_OPERATION_SINGLE /*single operation*/);
CheckError;
for
(i=0; i<3; i++){
//
Load breakpoint position - where breakpoint
should occur
err =
flex_load_pos_bp
(boardID, axis,
breakpointPosition[i], 0xFF);
CheckError;
//
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;