National Instruments NI-Motion User Manual

Page 186

Advertising
background image

Chapter 12

Synchronization

NI-Motion User Manual

12-36

ni.com

axis = NIMC_AXIS1;

////////////////////////////////

// Route HSC 1 to RTSI line 1

err = flex_select_signal (boardID, NIMC_HS_CAPTURE1

/*destination*/, NIMC_RTSI1/*source*/);

CheckError;

//Configure High-Speed Capture

err = flex_configure_hs_capture(boardID, axis,

NIMC_HS_LOW_TO_HIGH_EDGE, 0);

CheckError;

for

(i=0; i<6; i++){

// Enable the high speed capture on axis

err = flex_enable_hs_capture(boardID, axis,

NIMC_TRUE);

CheckError;

do

{

// Check the high-speed capture 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 the modal errors

if

(csr & NIMC_MODAL_ERROR_MSG)

{

err = csr & NIMC_MODAL_ERROR_MSG;

CheckError;

}

Sleep (10); //Check every 10 ms

}while (!(axisStatus &

NIMC_HIGH_SPEED_CAPTURE_BIT));

// Wait for high-speed capture to be triggered

err = flex_read_cap_pos_rtn(boardID, axis,

&capturedPositions[i]);

CheckError;

}

return

;// Exit the Application

//////////////////////

// Error Handling

Advertising