National Instruments NI-Motion User Manual

Page 241

Advertising
background image

Chapter 14

Onboard Programs

© National Instruments Corporation

14-33

NI-Motion User Manual

err = flex_read_var_rtn(boardID, 1,

&currentTargetPosition);

CheckError;

}

Sleep (50); //Check every 50 ms

}while (!(axisStatus & NIMC_FOLLOWING_ERROR_BIT) &&

!(axisStatus & NIMC_AXIS_OFF_BIT));

//Exit on move complete/following error/axis off

return

;// Exit the Application

// Error Handling

nimcHandleError; //NIMCCATCHTHIS:

// Check to see if there were any Modal Errors

if

(csr & NIMC_MODAL_ERROR_MSG){

do

{

//Get the command ID, resource ID, and the

error code of the //modal error from the

error stack on the device

flex_read_error_msg_rtn

(boardID,&commandI

D,&resourceID, &errorCode);

nimcDisplayError(errorCode,commandID,res

ourceID);

//Read the communication status register

flex_read_csr_rtn

(boardID,&csr);

}while(csr & NIMC_MODAL_ERROR_MSG);

}

else

// Display regular error

nimcDisplayError(err,0,0);

return

;// Exit the Application

}

Advertising