9Programming Examples
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.
*
*Once these parameters have been sent, the ":WAVEFORM:PREAMBLE?"
*query provides information concerning the vertical and horizontal
*scaling of the waveform data.
*
*With the preamble information you can then use the
*":WAVEFORM:DATA?" query and read the data block in the
*correct format.
*/
/* WAVE_FORMAT - Sets the data transmission mode for waveform data
*output. This command controls how the data is formatted when
*sent from the oscilloscope and can be set to WORD or BYTE format.
*/
/* Set waveform format to BYTE. */ iprintf(id, ":WAVEFORM:FORMAT BYTE\n");
/* WAVE_POINTS - Sets the number of points to be transferred.
*The number of time points available is returned by the
*"ACQUIRE:POINTS?" query. This can be set to any binary
*fraction of the total time points available.
*/
iprintf(id, ":WAVEFORM:POINTS 1000\n");
/* GET_PREAMBLE - The preamble contains all of the current WAVEFORM
*settings returned in the form <preamble block><NL> where the
*<preamble block> is:
* | FORMAT | : int16 - 0 | = | BYTE, 1 | = | WORD, 2 | = ASCII. |
| ||
* | TYPE | : int16 - 0 | = | NORMAL, | 1 | = | PEAK DETECT, 2 | = AVERAGE. | ||
* | POINTS | : int32 - | number of data points | transferred. | ||||||
* | COUNT | : int32 - | 1 | and is always | 1. |
|
|
*XINCREMENT : float64 - time difference between data points.
* | XORIGIN | : float64 - always the first data point in memory. |
556 | Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Reference |