Agilent B1500 VXIplug&play Driver User’s Guide, Edition 3 4-15
Programming Examples for C++ Users
Staircase Sweep Measurement
printf(" Vg (V), Vd (V), Id (mA)\n"); /* 72 */
for (j = 0; j < nop2; j++){
n = j * nop1;
for (i = n; i < n + nop1; i++){
printf(" %4.2f, %4.2f, %9.6f \n", dvg[j], sc[i], md[i] * 1000);
}
} /* 79 */
FILE *stream; /* 81 */
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 (j = 0; j < nop2; j++){
n = j * nop1;
for (i = n; i < n + nop1; i++){
fprintf( stream, "%4.2f, %4.2f, %9.6f, %8.6f, %d\n", dvg[j], sc[i], md[i]
* 1000, tm[i], st[i]);
}
}
printf( "%s%c", msg2, c );
}
if( fclose( stream ) ){
printf( "Data file was not closed\n" );
} /* 100 */
ret = agb1500_setSwitch(vi, agb1500_CH_ALL, 0); /* 102 */
check_err (vi, ret);
}
Line Description
72 to 79 Displays the measurement result data.
81 to 100 Saves the measurement results into a CSV file specified by the f_name variable.
102 Disables all ports.
103 Calls the check_err subprogram (shown in Table 4-1) to check if an error status is
returned for the previous line.
105 End of the perform_meas subprogram.