Programming Examples | 9 |
printf("Read setup string (%d bytes) from file.\n", setup_size); /* Restore setup string. */
iprintf(id, ":SYSTEM:SETUP #8%08d", setup_size); ifwrite(id, setup_string, setup_size, 1, &setup_size); printf("Restored setup string (%d bytes).\n", setup_size);
/* IMAGE_TRANSFER - In this example we will query for the image
*data with ":DISPLAY:DATA?" to read the data and save the data
*to the file "image.dat" which you can then send to a printer.
*/
itimeout(id, 30000);
printf("Transferring image to c:\\scope\\data\\screen.bmp\n"); img_size = IMG_SIZE;
ipromptf(id, ":DISPLAY:DATA? BMP8bit, SCREEN, COLOR\n", "%#b\n", &img_size, image_data);
printf("Read display data query (%d bytes).\n", img_size); /* Write image data to file. */
fp = fopen ("c:\\scope\\data\\screen.bmp", "wb");
img_size = fwrite(image_data, sizeof(unsigned char), img_size, fp); fclose (fp);
printf("Wrote image data (%d bytes) to file.\n", img_size); itimeout(id, 5000);
/* MEASURE - The commands in the MEASURE subsystem are used to
*make measurements on displayed waveforms.
*/
/* Set source to measure. */
iprintf(id, ":MEASURE:SOURCE CHANNEL1\n");
/* Query for frequency. */
ipromptf(id, ":MEASURE:FREQUENCY?\n", "%lf", &frequency); printf("The frequency is: %.4f kHz\n", frequency / 1000);
/* Query for peak to peak voltage. */ ipromptf(id, ":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)
Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Reference | 555 |