Agilent Technologies 86100-90086 Sprinkler User Manual


 
2-23
Sample Programs
Listings of the Sample Programs
gen_srq.c Sample Program
/* gen_srq.c */
/*
* This example programs initializes the Agilent 86100 scope, runs an
* autoscale, then generates and responds to a Service Request from the
* scope. The program assumes an Agilent 86100 at address 7, an interface card
* at interface select code 7, and a signal source attached to channel 1.
*/
#include <stdio.h> /* location of: printf ( ) */
#include "hpibdecl.h"
void initialize ( );
void setup_SRQ ( );
void create_SRQ ( );
void main ( void )
{
init_IO ( ); /* initialize interface and device sessions */
initialize ( ); /* initialize the scope and interface */
setup_SRQ ( ); /* enable SRQs on scope and set up SRQ handler */
create_SRQ ( ); /* generate SRQ */
close_IO ( ); /* close interface and device sessions */
} /* 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 performs an autoscale to acquire waveform data.
*/
void initialize ( )
{
write_IO ("*RST"); /* reset scope - initialize to known state */
write_IO ("*CLS"); /* clear status registers and output queue */
write_IO (":SYSTem:HEADer OFF"); /* turn off system headers */
write_IO (":AUToscale"); /* perform autoscale */
} /* end initialize ( ) */
/*
* Function name: setup_SRQ
* Parameters: none
* Return value: none
* Description: This routine initializes the device to generate Service
* Requests. It sets the Service Request Enable Register Event Status Bit
* and the Standard Event Status Enable Register to allow SRQs on Command
* or Query errors.