National Instruments NI-Motion User Manual
Page 269

Chapter 15
Scanning
15-18
ni.com
vectorSpace = NIMC_VECTOR_SPACE1;
// Configure a 2D vector space comprised of axes 1
and 2
err = flex_config_vect_spc(boardID, vectorSpace,
NIMC_AXIS1, NIMC_AXIS2, NIMC_AXIS3);
CheckError;
// Set the operation mode to absolute position
err = flex_set_op_mode(boardID, vectorSpace,
NIMC_ABSOLUTE_CONTOURING);
CheckError;
// Configure buffer on motion controller memory (RAM)
// Notice requested time interval is hardcoded to 10
milliseconds
err = flex_configure_buffer(boardID, 1 /*buffer
number*/, vectorSpace, NIMC_POSITION_DATA,
bufferSize, numPoints, NIMC_TRUE, 10,
&actualInterval);
// Send the first 1000 points of the data
downloadData = malloc(sizeof(i32)*bufferSize);
for
(i=0;i points[i];currentDataPoint++;} err = flex_write_buffer(boardID, 1/*buffer number*/, bufferSize, 0, downloadData, 0xFF); free(downloadData); downloadData = NULL; CheckError; // Start Motion err = flex_start(boardID, vectorSpace, 0); CheckError; for (;;){ axisStatus = 0; // Check for available space and download remaining points //every 50 milliseconds Sleep(50); // Check to see if there are more points to download if (currentDataPoint < numPoints){ err = flex_check_buffer_rtn(boardID, 1/*buffer number*/, &backlog, &bufferState, &pointsDone); CheckError;