Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4 5-37
Programming Examples for C++ Users
Sampling Measurements
ret = hp4156b_setSample(vi, hold, interval, nop); /* 34 */
ret = hp4156b_addSampleSyncIv(vi, t1, hp4156b_VF_MODE, 0, base, bias, icomp);
ret = hp4156b_addSampleSyncIv(vi, t2, hp4156b_VF_MODE, 0, base, bias, icomp);
ret = hp4156b_force(vi, low, hp4156b_VF_MODE, 0, vlout, ilcomp, 0);
check_err (vi, ret);
ret = hp4156b_sample(vi, mch, mode, range, &point, &index[0], &value[0],
&status[0]); /* 40 */
check_err (vi, ret);
ret = hp4156b_zeroOutput(vi, hp4156b_CH_ALL);
check_err (vi, ret);
if ( point != nop ) { /* 46 */
printf ("%d measurement data were returned.\nIt must be %d data.\n", point,
nop);
ret = hp4156b_clearSampleSync(vi);
ret = hp4156b_setSwitch(vi, hp4156b_CH_ALL, 0);
check_err (vi, ret);
exit (ret);
}
ViInt32 i; /* 54 */
ViChar f_name[] = "C:\Agilent\data\data7.txt";
ViChar head1[] = "Index, I1 (mA), R1 (ohm), I2 (mA), R2 (ohm), Status";
ViChar msg1[] = "Saving data...";
ViChar msg2[] = "Data save completed.";
ViChar c = ’\n’;
Line Description
34 Sets the sampling measurement timing parameters and the number of samples.
35 to 36 Sets the constant voltage sources for the sampling measurement.
37 Applies voltage to the low terminal of the device.
40 Performs the sampling measurement using the channels specified by mch.
43 Sets the specified port to the zero output state.
46 to 52 Clears the sampling source setup information, disables all ports, and stops the
program execution if the number of returned data is not equal to the nop value.
38, 41, 44, and 50 Calls the check_err subprogram (shown in Table 5-1) to check if an error status is
returned for the previous line.
54 to 59 Declares variables, and defines the value.