Agilent Technologies 86100-90086 Sprinkler User Manual


 
2-19
Sample Programs
Listings of the Sample Programs
* Description: This routine acquires data according to the current instrument settings.
*/
void acquire_data ( )
{
/*
* The root level :DIGitize command is recommended for acquisition of new
* data. It will initialize data buffers, acquire new data, and ensure that
* acquisition criteria are met before acquisition of data is stopped.
* The captured data is then available for measurements, storage, or transfer
* to a PC. Note that the display is automatically turned off by the
* :DIGitize command and must be turned on to view the captured data.
*/
write_IO (":DIGitize CHANnel1");
write_IO (":CHANnel1:DISPlay ON"); /* turn on channel 1 display which is turned off by the :DIGitize command */
} /* end acquire_data() */
/*
* Function name: auto_measurements
* Parameters: none
* Return value: none
* Description: This routine performs automatic measurements of volts
* peak-to-peak and period on the acquired data. It also demonstrates
* two methods of error detection when using automatic measurements.
*/
void auto_measurements ( )
{
float period, vpp;
unsigned char vpp_str[16];
unsigned char period_str[16];
int bytes_read;
/*
* 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.
* METHOD ONE - turn on results to indicate whether the measurement completed
* successfully. Note that this requires transmission of extra data from the scope.
*/
write_IO (":MEASure:SEND ON"); /* turn results on */
/* query -- volts peak-to-peak channel 1*/