Chapter 14
Onboard Programs
14-14
ni.com
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
}
Using Onboard Memory and Data
NI motion controllers allow you to access the onboard RAM and FLASH
to create data buffers and use some general-purpose onboard variables for
data manipulation. You can use this memory to update data that is loaded
by functions that are executing in an onboard program. You also can
synchronize execution or data between the host computer and the motion
controller. For example, you may want to update the velocity of an axis
based on the analog voltage read from an ADC channel. This memory is
statically allocated.