Chapter 3
149
Programming Examples
Status Register–Determine When a Measurement is Done
Status Register–Determine When a Measurement is
Done
/************************************************************/
/* Status Register - Determine when a measurement is done */
/* */
/* This example is for the E44xxB ESA Spectrum Analyzers */
/* and E740xA EMC Analyzers. */
/* */
/* This C programming example does the following. */
/* The SCPI instrument commands used are given as */
/* reference. */
/* */
/* - Opens a GPIB session at address 18 */
/* - Resets the Analyzer */
/* *RST */
/* - Clears the analyzer status byte */
/* *CLS */
/* - Sets the analyzer to single sweep mode */
/* INIT:CONT 0 */
/* - Route the amplitude reference to the analyzer input */
/* CAL:SOUR:STAT ON */
/* - Set the analyzer center frequency, span and Res BW */
/* SENS:FREQ:CENT 50 MHz */
/* SENS:FREQ:SPAN 10 MHz */
/* SENS:BAND:RES 300 kHz */
/* - Trigger a sweep and wait for completion of sweep */
/* INIT:IMM */
/* *OPC? */
/* - Sets the service request mask to assert SRQ when */
/* either a measurement is uncalibrated or an error */
/* message has occurred. */
/* *SRE 96 */
/* *ESE 35 */
/* - Set the computer to response to an interrupt */
/* - Send an undefined command to the ESA */
/* IDN (illegal command) */
/* - Wait for the SRQ */
/* - When an interrupt occurs, poll all instruments */
/* - Report the nature of the interrupt on the ESA analyzer */
/* - Pause 5 seconds to observe the analyzer */
/* - Set the ESA to perform 80 video averages */
/* SENS:AVER:TYPE LPOW */
/* SENS:AVER:COUN 80 */