Programming Examples
12
Agilent InfiniiVision 7000A Series Oscilloscopes Programmer's Guide
851
/* MEASURE - The commands in the MEASURE subsystem are used to
* make measurements on displayed waveforms.
*/
/* Set source to measure. */
viPrintf(vi, ":MEASURE:SOURCE CHANNEL1\n");
/* Query for frequency. */
viQueryf(vi, ":MEASURE:FREQUENCY?\n", "%lf", &frequency);
printf("The frequency is: %.4f kHz\n", frequency / 1000);
/* Query for peak to peak voltage. */
viQueryf(vi, ":MEASURE:VPP?\n", "%lf", &vpp);
printf("The peak to peak voltage is: %.2f V\n", vpp);
/* WAVEFORM_DATA - Get waveform data from oscilloscope.
*/
get_waveform();
/* Make some calculations from the preamble data. */
vdiv
= 32 * preamble [7];
off
= preamble [8];
sdiv
= preamble [2] * preamble [4] / 10;
delay = (preamble [2] / 2) * preamble [4] + preamble [5];
/* Print them out... */
printf ("Scope Settings for Channel 1:\n");
printf ("Volts per Division = %f\n", vdiv);
printf ("Offset = %f\n", off);
printf ("Seconds per Division = %f\n", sdiv);
printf ("Delay = %f\n", delay);
/* print out the waveform voltage at selected points */
for (i = 0; i < 1000; i = i + 50)
printf ("Data Point %4d = %6.2f Volts at %10f Seconds\n", i,
((float)waveform_data[i] - preamble[9]) * preamble[7] +
preamble[8],
((float)i - preamble[6]) * preamble[4] + preamble[5]);
save_waveform();
/* Save waveform data to disk. */
retrieve_waveform();
/* Load waveform data from disk. */
}
/*
* get_waveform
* ------------------------------------------------------------------
* This function transfers the data displayed on the oscilloscope to
* the computer for storage, plotting, or further analysis.
*/
void get_waveform (void)
{
int waveform_size;
/* WAVEFORM_DATA - To obtain waveform data, you must specify the
* WAVEFORM parameters for the waveform data prior to sending the
* ":WAVEFORM:DATA?" query.
Summary of Contents for InfiniiVision 7000A Series
Page 1: ...Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide...
Page 34: ...34 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 1 What s New...
Page 44: ...44 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 2 Setting Up...
Page 58: ...58 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 3 Getting Started...
Page 750: ...750 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 8 Error Messages...
Page 922: ...922 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide Index...