National Instruments NI-Motion User Manual

Page 129

Advertising
background image

Chapter 10

Electronic Gearing and Camming

© National Instruments Corporation

10-7

NI-Motion User Manual

// Load the target position for the registration

(superimposed) //move

err = flex_load_target_pos(boardID, slaveAxis, 5000,

0xFF);

CheckError;

// Start registration move on the slave

err = flex_start(boardID, slaveAxis, 0);

CheckError;

err = flex_wait_for_move_complete (boardID,

slaveAxis, 0, 1000/*ms timeout*/,

20/*ms pollInterval*/, &moveComplete);

CheckError;

//-------------------------------------------------

// Disable gearing on slave axis

//-------------------------------------------------

err = flex_enable_gearing_single_axis (boardID,

slaveAxis, NIMC_FALSE);

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