Chapter 14
Onboard Programs
©
National Instruments Corporation
14-41
//
Insert Label number 2
err =
flex_insert_program_label
(boardID, 2);
CheckError;
//
Execute program 2
err =
flex_run_prog
(boardID, 2);
CheckError;
//
Wait for program 2 to finish executing
err =
flex_wait_on_event
(boardID, 2 /*program #*/,
NIMC_WAIT, NIMC_CONDITION_PROGRAM_COMPLETE, 0, 0,
NIMC_MATCH_ALL, 1000 /*time out*/, 0);
CheckError;
//
Jump unconditionally to label 1 and check IO line
again
err =
flex_jump_on_event
(boardID, 0,
NIMC_CONDITION_TRUE, 0, 0, NIMC_MATCH_ALL, 1/*label
number*/);
CheckError;
//
End Program Storage
err =
flex_end_store
(boardID, 1);
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
}