Chapter 7
Contoured Moves
7-8
ni.com
for
(i=0;i<bufferSize;i++){
downloadData[i] = points[currentDa+];
}
err =
flex_write_buffer
(boardID, 1/*buffer number*/,
bufferSize, NIMC_REGENERATION_NO_CHANGE,
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;
if
(backlog >= 300){
downloadData =
malloc(sizeof(
i32
)*backlog);
dataCopied = 0;
for
(i=0;i<backlog;i++){
if
(currentDataPoint >
numPoints) break;
downloadData[i] =
points[currentDa+];
dat+;
}
err =
flex_write_buffer
(boardID, 1
/*buffer number*/, dataCopied,
NIMC_REGENERATION_NO_CHANGE,
downloadData, 0xFF);
free(downloadData);
downloadData = NULL;