2-17
Sample Programs
Listings of the Sample Programs
unsigned char read_status ( );
void close_IO ( );
void hpiberr ( );
void srq_handler ( );
init.c Sample Program
/* init. c */
/*
* Command Order Example. This program demonstrates the order of commands
* suggested for operation of the Agilent 86100 analyzer via GPIB.
* This program initializes the scope, acquires data, performs
* automatic measurements, and transfers and stores the data on the
* PC as time/voltage pairs in a comma-separated file format useful
* for spreadsheet applications. It assumes a SICL INTERFACE exists
* 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 */