Chapter 5 Straight-Line Moves
© National Instruments Corporation 5-7 NI-Motion User Manual
// 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,
resourceID);
//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
}
2D Straight-Line Move Code
// Main Function
void main(void)
{
u8 boardID;// Board identification number
u8 vectorSpace;// Vector space number
u16 csr = 0;// Communication status register
u16 axisStatus;// Axis status
u16 status;
u16 moveComplete;
//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 vector space
vectorSpace = NIMC_VECTOR_SPACE1;