Agilent Technologies 86100-90086 Sprinkler User Manual


 
2-7
Sample Programs
Sample C Programs
period_str [bytes_read-2]);
else
printf ("Period is %f\n",(float)atof (period_str));
/*
* METHOD TWO - perform automated measurements and error checking with
* :MEAS:RESULTS OFF
*/
period = (float) 0;
vpp = (float) 0;
/* turn off results */
write_IO (":MEASure:SEND OFF");
write_IO (":MEASure:PERiod? CHANnel1"); /*period 1 */
bytes_read = read_IO (period_str,16L); /* read in value and result flag */
period = (float) atof (period_str);
if (period > 9.99e37 )
printf ("\nPeriod could not be measured.\n");
else
printf ("\nThe period of channel 1 is %f seconds.\n", period );
write_IO (":MEASure:VPP? CHANnel1");
bytes_read = read_IO ( vpp_str,16L );
vpp = (float) atof (vpp_str);
if ( vpp > 9.99e37 )
printf ("Peak-to-peak voltage could not be measured.\n");
else
printf ("The voltage peak-to-peak is %f volts.\n", vpp );
} /* end auto_measurements () */
init.c - Error Checking
/* Error checking on automatic measurements can be done using one of two methods.
* The first method requires that you turn on results in the Measurements
* subsystem using the command :MEASure:SEND ON. When this is on, the analyzer
* will return the measurement and a result indicator. The result flag is zero
* if the measurement was successfully completed, otherwise a non-zero value is
* returned which indicates why the measurement failed. See the Programmer's Manual
* for descriptions of result indicators.
* The second method simply requires that you check the return value of the
* measurement. Any measurement not made successfully will return with the value
* +9.999E37. This could indicate that either the measurement was unable to be
* performed, or that insufficient waveform data was available to make the
* measurement.