178 Chapter 3
Programming Examples
Making Faster Measurements (multiple measurements)
/* FORM:DAT INT,32 */
/* - Select appropriate byte order (Intel) */
/* FORM:BORD SWAP */
/* - Repeat the following the requested number of times: */
/* - Trigger a measurement and wait for completion */
/* INIT:*OPC? */
/* - Read the resulting measurement trace */
/* TRAC:DATA? TRACE1 */
/* - Compute running averaged power at all trace points */
/* - Display measurement statistics */
/* - Write averaged data to second trace display */
/* TRAC:DATA TRACE2 <definite length block of data> */
/* - Enable viewing of second trace */
/* TRACE2:MODE VIEW */
/* - Enable local display for viewing */
/* DISP:ENAB ON */
/* - Select continuous sweep mode */
/* INIT:CONT ON */
/* - Close session and Return instrument to local control */
/************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys\timeb.h>
#include <visa.h>
#define hpESA_IDN_E4401B "Hewlett-Packard, E4401B"
#define hpESA_IDN_E4411B "Hewlett-Packard, E4411B"
#define hpEMC_IDN_E7401A "Hewlett-Packard, E7401A"
#define NUM_TRACES 100 /* number of traces to average
*/
#define NUM_POINTS 401 /* requested number of points/trace
*/
#define CENTER 50 /* center frequency in MHz, an integer
*/
#define SPAN 20 /* span frequency in MHz, an integer */
#define RBW 300 /* resolution BW in kHz, an integer */
#define DISPLAY 0 /* ESA display enable, disable for speed
*/
#define DATA_LENGTH 4 /* number of data bytes in one trace point
*/
#define MAX_POINTS 8192 /* maximum number of points/trace in ESA