EasyManuals Logo

Agilent Technologies 4155C User Manual

Agilent Technologies 4155C
312 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #186 background imageLoading...
Page #186 background image
5-4 Agilent 4155C/4156C VXIplug&play Driver Users Guide, Edition 4
Programming Examples for C++ Users
Programming Basics
Table 5-1 Example Template Program Code for Visual C++
#include <stdio.h> /* 1 */
#include <stdlib.h>
#include <visa.h>
#include "hp4156b.h"
void check_err (ViSession vi, ViStatus ret) { /* 6 */
ViInt32 inst_err;
ViChar err_msg[256];
if(VI_SUCCESS > ret) {
if ( hp4156b_INSTR_ERROR_DETECTED == ret ) {
hp4156b_error_query(vi, &inst_err, err_msg);
printf("Instrument Error: %ld\n %s\n", inst_err, err_msg);
}
else {
hp4156b_error_message(vi, ret, err_msg);
printf("Driver Error: %ld\n %s\n", ret, err_msg);
}
}
} /* 20 */
void perform_meas (ViSession vi, ViStatus ret) { /* 22 */
/* insert program code */
}
ViStatus main ( ) /* 26 */
{
ViStatus ret; /* 28 */
ViSession vi;
ViChar err_msg[256]; /* 30 */
Line Description
1 to 4 Required to use the Agilent 4155/4156 VXIplug&play driver. The header files contain
various necessary information such as function declaration and macro definitions.
You may add the include statements to call another header files that may be needed by
the codes you added. Also, the include statements may be written in a header file that
will be called by the source file (e.g. #include <stdio.h> may be written in the stdafx.h
header file that will be called by the source file).
6 to 20 Checks if the passed “ret” value indicates normal status, and returns to the line that
called this subprogram. If the value indicates an instrument error status or a device error
status, the error message will be displayed.
22 to 24 Complete the perform_meas subprogram to perform measurement.
26 Beginning of the main program.
28 to 30 Declares variables used in the main program.

Table of Contents

Other manuals for Agilent Technologies 4155C

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies 4155C and is the answer not in the manual?

Agilent Technologies 4155C Specifications

General IconGeneral
BrandAgilent Technologies
Model4155C
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals