Agilent Technologies 5000 Series Sander User Manual


 
554 Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Reference
9 Programming Examples
* communication with the computer interrupts data acquisition.
* Setting up the oscilloscope over the bus causes the data
* buffers to be cleared and internal hardware to be reconfigured.
* If a measurement is immediately requested there may not have
* been enough time for the data acquisition process to collect
* data and the results may not be accurate. An error value of
* 9.9E+37 may be returned over the bus in this situation.
*/
iprintf(id, ":DIGITIZE CHAN1\n");
}
/*
* analyze
* ------------------------------------------------------------------
* In this example we will do the following:
* - Save the system setup to a file for restoration at a later time.
* - Save the oscilloscope display to a file which can be printed.
* - Make single channel measurements.
*/
void analyze (void)
{
double frequency, vpp; /* Measurements. */
double vdiv, off, sdiv, delay; /* Calculated from preamble data. */
int i; /* Loop counter. */
/* Array for setup string. */
unsigned char setup_string[SETUP_STR_SIZE];
int setup_size;
FILE *fp;
unsigned char image_data[IMG_SIZE]; /* Array for image data. */
int img_size;
/* SAVE_SYSTEM_SETUP - The :SYSTEM:SETUP? query returns a program
* message that contains the current state of the instrument. Its
* format is a definite-length binary block, for example,
* #800002204<setup string><NL>
* where the setup string is 2204 bytes in length.
*/
setup_size = SETUP_STR_SIZE;
/* Query and read setup string. */
ipromptf(id, ":SYSTEM:SETUP?\n", "%#b\n", &setup_size, setup_string);
printf("Read setup string query (%d bytes).\n", setup_size);
/* Write setup string to file. */
fp = fopen ("c:\\scope\\config\\setup.dat", "wb");
setup_size = fwrite(setup_string, sizeof(unsigned char), setup_size,
fp);
fclose (fp);
printf("Wrote setup string (%d bytes) to file.\n", setup_size);
/* RESTORE_SYSTEM_SETUP - Uploads a previously saved setup string
* to the oscilloscope.
*/
/* Read setup string from file. */
fp = fopen ("c:\\scope\\config\\setup.dat", "rb");
setup_size = fread (setup_string, sizeof(unsigned char),
SETUP_STR_SIZE, fp);
fclose (fp);