2-3
Sample Programs
C Programming Examples
* as 'gpib7' and an Agilent 86100 analyzer at address 7.
* It also requires the cal signal attached to Channel 1.
*
* See the README file on the demo disk for development and linking information.
*/
#include <stdio.h> /* location of: printf ( ) */
#include <stdlib.h> /* location of: atof(), atoi ( ) */
#include "hpibdecl.h" /* prototypes, global declarations, constants */
void initialize ( ); /* initialize the scope */
void acquire_data ( ); /* digitize signal */
void auto_measurements ( ); /* perform built-in automatic measurements */
void transfer_data ( ); /* transfers waveform data from scope to PC */
void convert_data ( ); /* converts data to time/voltage values */
void store_csv ( ); /* stores time/voltage pairs to comma-separated variable file format */
/* GLOBALS */
int count;
double xorg,xref,xinc; /* values necessary for conversion of data */
double yorg,yref,yinc;
int Acquired_length;
char data [MAX_LENGTH]; /* data buffer */
double time_value [MAX_LENGTH];/* time value of data */
double volts [MAX_LENGTH]; /* voltage value of data */
void main( void )
{
/* initialize interface and device sessions */
/* note: routine found in sicl_IO.c or natl_IO.c */
init_IO ( );
initialize ( ); /* initialize the scope and interface and set up SRQ */
acquire_data ( ); /* capture the data */
auto_measurements ( ); /* perform automated measurements on acquired data */
transfer_data ( ); /* transfer waveform data to the PC from scope */
convert_data ( ); /* convert data to time/voltage pairs */
store_csv ( ); /* store the time/voltage pairs as csv file */
close_IO ( ); /* close interface and device sessions */
/* note: routine found in sicl_IO.c or natl_IO.c */
} /* end main ( ) */
/*
* Function name: initialize
* Parameters: none
* Return value: none
* Description: This routine initializes the analyzer for proper
* acquisition of data. The instrument is reset to a known state and the
* interface is cleared. System headers are turned off to allow faster
* throughput and immediate access to the data values requested by queries.
* The analyzer time base, channel, and trigger subsystems are then
* configured. Finally, the acquisition subsystem is initialized.
*/