National Instruments NI-Motion User Manual

Page 64

Advertising
background image

Chapter 5

Straight-Line Moves

© National Instruments Corporation

5-9

NI-Motion User Manual

CheckError;

// Check the following error/axis off status for

axis 1

err = flex_read_axis_status_rtn(boardID, 1,

&status);

CheckError;

axisStatus |= status;

// Check the following error/axis off status for

axis 2

err = flex_read_axis_status_rtn(boardID, 2,

&status);

CheckError;

axisStatus |= status;

// 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;

}

}while (!moveComplete && !(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

Advertising