5-38 Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4
Programming Examples for C++ Users
Sampling Measurements
printf(" Index, R1 (ohm), R2 (ohm)\n"); /* 61 */
for (i = 0; i < nop; i++){
printf(" %2d, %6.3f, %6.3f \n", index[i], bias/value[2 * i], bias/value[2
* i + 1]);
} /* 64 */
FILE *stream; /* 66 */
if( ( stream = fopen( f_name, "w+" )) == NULL ){
printf( "Data file was not opened\n" );
}
else {
printf( "%s%c", msg1, c );
fprintf( stream, "%s%c", head1, c );
for (i = 0; i < nop; i++){
fprintf(stream,"%2d,%7.3f,%6.3f,%7.3f,%6.3f, %d\n",index[i],value[2 * i] *
1000, bias/value[2 * i], value[2 * i + 1] * 1000, bias/value[2 * i + 1], status[i]);
}
printf( "%s%c", msg2, c );
}
if( fclose( stream ) ){
printf( "Data file was not closed\n" );
} /* 82 */
ret = hp4156b_clearSampleSync(vi);
ret = hp4156b_setSwitch(vi, hp4156b_CH_ALL, 0);
check_err (vi, ret);
}
Line Description
61 to 64 Displays the measurement result data.
66 to 82 Saves the measurement results into a file (C:\Agilent\data\data7.txt, CSV file).
84 Clears the source setup information for the sampling measurement.
85 Disables all ports.
86 Calls the check_err subprogram (shown in Table 5-1) to check if an error status is
returned for the previous line.
87 End of the perform_meas subprogram.