Agilent Technologies Agilent B2201A User Manual
Page 128

4-28
Agilent B2200 User’s Guide, Edition 4
Programming
Capacitance Compensation
Table 4-13
Capacitance Compensation Program Example
#include "stdafx.h"
#include
#include
#include
#include "agb220xa.h"
ViStatus main()
{
ViStatus ret;
ViSession vi;
ViChar err_msg[256];
ret = agb220xa_init("GPIB0::22::INSTR", VI_TRUE, VI_TRUE, &vi);
if ( ( ret < VI_SUCCESS ) || ( vi == VI_NULL ) ) {
printf("Initialization failure.\n Status code: %d.\n", ret);
if ( vi != VI_NULL ) {
agb220xa_error_message(vi, ret, err_msg);
printf("Error: %ld\n %s\n", ret, err_msg);
}
exit (ret);
}
//20
ret = agb220xa_reset(vi);
ViChar f_com[] = "C:/temp/my_env_1.txt";
//23
ret = agb220xa_selectCompenFile(vi, f_com);
ViReal64 freq = 1e+06;
// measurement frequency: 1 (MHz)
ViReal64 data_c = 100e-12; // C measured by 4284A: 100 (pF)
ViReal64 data_g = 500e-06; // G measured by 4284A: 500 (uS)
ViReal64 res_c;
ViReal64 res_g;
ret = agb220xa_compenC(vi, freq, data_c, data_g, &res_c, &res_g);
//31
printf("C = %3.6f pF\n", res_c * 1e+12);
//33
printf("G = %3.6f uS\n", res_g * 1e+06);
ret = agb220xa_close(vi);
}
Line
Description
1 to 20
The above example is for the B2200 of the GPIB address 22 on the interface GPIB0.
“GPIB0” is the VISA name. Confirm your GPIB settings, and set them properly.
23 to 24
The lines specify the compensation data file. The file name must specify your
compensation data file.
26 to 31
Compensates the data measured by the Agilent 4284A. In this example, the measurement
frequency is 1 MHz, the capacitance data is 100 pF, and the conductance data is 0.5 mS.
Change freq, data_c, data_g values for your measurement results.
33 to 34
Displays the compensation result data on the console window. Record the values as C1r and
G1r, or C2r and G2r.