National Instruments NI-Motion User Manual

Page 271

Advertising
background image

Chapter 15

Scanning

NI-Motion User Manual

15-20

ni.com

err = flex_read_axis_status_rtn(boardID,

NIMC_AXIS2, &status);

CheckError;

axisStatus |= status;

if

( (axisStatus & NIMC_FOLLOWING_ERROR_BIT) ||

(axisStatus & NIMC_AXIS_OFF_BIT) ){

break;//Break out of the for loop because

an axis was killed

}

}

//Set the mode back to absolute mode to get the motion

controller out of //contouring mode

err = flex_set_op_mode(boardID, vectorSpace,

NIMC_ABSOLUTE_POSITION);

CheckError;

// Free the buffer allocated on the motion controller

memory

err = flex_clear_buffer(boardID, 1/*buffer

number*/);

CheckError;

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