National Instruments NI-Motion User Manual
Page 181

Chapter 12
Synchronization
© National Instruments Corporation
12-31
if
(backlog > 0)
{
readBuffer =
(i32*)malloc(sizeof(i32)*backlog);
// If captured position available in the
buffer, read the //captured position from
the buffer
err = flex_read_buffer_rtn(boardID,
1/*buffer number*/, backlog, readBuffer);
for
(i=0;i if (currentDataPoint > totalPoints) break; capturedPositions[currentDa taPoint] = readBuffer[i]; printf("capture pos %d\n", capturedPositions[currentDataPoin t]); currentDataPoint++; } free(readBuffer); readBuffer = NULL; CheckError; } // Check for axis off status/following error or any modal //errors; 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(60);// Check every 60 ms } while (bufferState != NIMC_BUFFER_DONE); // Free the buffer allocated on the motion controller memory err = flex_clear_buffer(boardID, 1/*buffer number*/);