Error Handling - HP 8163A Programming Manual

Lightwave measurement system
Hide thumbs Also See for HP 8163A:
Table of Contents

Advertisement

The HP 816x VXIplug&play Instrument Driver

Error Handling

A.8 Error Handling
Events and errors within a instrument control program can be
detected by polling (querying) the instrument. Polling is used in
application development environments (ADEs) that do not support
asynchronous activities where callbacks can be used.
Programs can set up and use polling as shown below.
1 Declare a variable to contain the function completion code.
ViStatus errStatus;
Every driver function returns the completion code ViStatus.
If the function executes with no I/O errors, driver errors, or
instrument errors, ViStatus is 0 (VI_SUCCESS).
If an error occurs, ViStatus is a negative error code.
Warnings are positive error codes, and indicate the operation
succeeded but special conditions exist.
2 Enable automatic instrument error checking following each
function call.
hp816x_errorQueryDetect
(instrumentHandle, VI_TRUE);
When enabled, the driver queries the instrument for an error
condition before returning from the function.
If an error occurred, errStatus (Step 1) will contain a code
indicating that an error was detected
(hp816x_INSTR_ERROR_DETECTED).
3 Check for an error (or event) after each function.
errStatus = hp816x_cmd(instrumentHandle,
"SENS1:POW:RANG");
check(instrumentHandle, errStatus);
After the function executes, errStatus contains the
completion code.
The completion code and instrument ID are passed to an error
checking routine. In the above statement, the routine is called
'check'.
182

Advertisement

Table of Contents
loading

This manual is also suitable for:

Hp 8164a

Table of Contents