Chapter 7
7-15
Programming Examples
Measurement Setup Examples
ViSession vi;
ViStatuserr_status;
ViChar err_message[256];
/* Note that this function can verify that the instrument specified is an */
/* hp875x (id_query=VI_TRUE) and can send a reset to the instrument */
/* (do_reset=VI_TRUE). */
err_status = hp875x_init(Nwa, id_query, do_reset, &vi);
if (( err_status < VI_SUCCESS ) || ( vi == VI_NULL ))
{
printf(“\ninit failed with return code %d\n”, err_status);
if ( vi != VI_NULL )
{
hp875x_error_message(vi,err_status,err_message);
printf(“ Error Status: %d\n”, err_status);
printf(“ Error Message: %s\n”, err_message);
}
exit (err_status);
}
*vi_ptr = vi;
return(VI_SUCCESS);
}
ViStatus checkErr (ViSession vi, ViStatus err_status)
{
ViInt32 inst_err;
ViChar err_message[256];
if(VI_SUCCESS > err_status)
{
/* Send a device clear to ensure communication with */
/* the instrument.
*/
hp875x_dcl(vi);
/* If the driver is set to detect instrument errors, and */
/* an instrument error is detected, the error code is */
/* hp875x_INSTR_ERROR_DETECTED (see 875x_cpp.h). In this */
/* case, query the instrument for the error and display */
/* it. Otherwise, the error is a driver error. Query the */
/* driver for the error and display it. */
if(hp875x_INSTR_ERROR_DETECTED == err_status)
{
hp875x_error_query(vi, &inst_err, err_message);
printf(“Instrument Error : %ld, %s\n”, inst_err, err_message);
}
else
{
hp875x_error_message(vi, err_status, err_message);
printf(“Driver Error : %ld, %s\n”, err_status, err_message);
Summary of Contents for 8719ES
Page 15: ...1 1 1 Alphabetical Command Reference ...
Page 293: ...2 1 2 Introduction to Instrument Control ...
Page 310: ...3 1 3 GPIB Programming ...
Page 334: ...4 1 4 Reading Analyzer Data ...
Page 343: ...5 1 5 Data Processing Chain ...
Page 350: ...6 1 6 Error Reporting ...
Page 364: ...7 1 7 Programming Examples ...
Page 502: ...A 1 A Preset Conditions ...
Page 517: ...B 1 B Command Listings ...