Chapter 12
Synchronization
12-30
ni.com
u32
pointsDone;//
Indicates the number of points that
have been
//
consumed
u16
bufferState;//
Indicates the state of the onboard
buffer
u32
currentDataPoint = 0;//
Indicates the next points
to be read
//
from the buffer
i32
* readBuffer = NULL;//
The temporary array that is
created to
//
read captured positions
u32
i;
//
Variables for modal error handling
u16 commandID;//
The commandID of the function
u16 resourceID;//
The resource ID
i32 errorCode;//
Error code
///////////////////////////////
//
Set the board ID
boardID = 1;
//
Set the axis number
axis = NIMC_AXIS1;
////////////////////////////////
//
Configure buffer on motion controller memory (RAM)
//
Notice requested time interval is hardcoded to 10
milliseconds
err =
flex_configure_buffer
(boardID, 1 /*buffer
number*/, axis, NIMC_HS_CAPTURE_READBACK,
bufferSize, totalPoints, NIMC_TRUE, 10,
&actualInterval);
CheckError;
//
Configure High-Speed Capture
err =
flex_configure_hs_capture
(boardID, axis,
NIMC_HS_LOW_TO_HIGH_EDGE, NIMC_OPERATION_BUFFERED);
CheckError;
//
Enable the high-speed capture on axis
err =
flex_enable_hs_capture
(boardID, axis,
NIMC_TRUE);
CheckError;
do
{
err =
flex_check_buffer_rtn
(boardID, 1/*buffer
number*/, &backlog, &bufferState, &pointsDone);
CheckError;
//
Check backlog for captured position in buffer