5-20 Agilent 4155C/4156C VXIplug&play Driver User’s Guide, Edition 4
Programming Examples for C++ Users
Multi-Channel Sweep Measurements
Measurement
Result Example
Vb (V), Ic (mA), Ib (mA), hfe, Status_c, Status_b
0.30, 0.00000083, -0.00000001, -59.41935484, 0, 0
0.35, 0.00000557, 0.00000005, 123.29646018, 0, 0
0.40, 0.00003837, 0.00000032, 119.64452760, 0, 0
0.45, 0.00026580, 0.00000190, 140.15291326, 0, 0
0.50, 0.00185550, 0.00001155, 160.64935065, 0, 0
0.55, 0.01274500, 0.00007378, 172.73158501, 0, 0
0.60, 0.08796500, 0.00047225, 186.26786660, 0, 0
0.65, 0.60135000, 0.00303550, 198.10574864, 0, 0
0.70, 3.84650000, 0.01897000, 202.76752768, 0, 0
0.75, 18.79500000, 0.09735000, 193.06625578, 0, 0
0.80, 55.71000000, 0.33300000, 167.29729730, 0, 0
ViInt32 i; /* 67 */
ViInt32 n;
printf(" Vb (V), Ic (mA), Ib (mA)\n");
for (i = 0; i < nop; i++){
printf(" %4.2f, %11.8f, %11.8f\n", sc[i], md[2*i] * 1000, md[2*i+1] * 1000);
}
ViChar f_name[] = "C:\Agilent\data\data3.txt"; /* 74 */
ViChar head1[] = "Vb (V), Ic (mA), Ib (mA), hfe, Status_c, Status_b";
ViChar msg1[] = "Saving data...";
ViChar msg2[] = "Data save completed.";
ViChar c = ’\n’;
FILE *stream;
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, "%4.2f, %11.8f, %11.8f, %12.8f, %d, %d\n", sc[i], md[2*i] *
1000, md[2*i+1] * 1000, md[2*i]/md[2*i+1], st[2*i], st[2*i+1]);
}
printf( "%s%c", msg2, c );
}
if( fclose( stream ) ){
printf( "Data file was not closed\n" );
}
} /* 96 */
Line Description
67 to 72 Displays the measurement result data.
74 to 95 Saves the measurement results into a file (C:\Agilent\data\data3.txt, CSV file).
96 End of the perform_meas subprogram.