Agilent Technologies ESA-E Series Programmer's Manual page 91

Esa spectrum analyzers
Hide thumbs Also See for ESA-E Series:
Table of Contents

Advertisement

Programming Examples
Reading Trace Data Using 32-bit Real Format (GPIB )
ViReal32 dTraceArray[401] = {0} ;
char cBufferInfo[6]= {0} ;
long lNumberBytes =0L ;
long lOpc =OL ;
unsigned long lRetCount = OL ;
int iSize = 0 ;
/*BytesPerPoint is 4 for Rea132 or Int32 formats, 8 for Rea164, and 2 for Uintl6* /
int iBytesPerPnt = 4 ;
int iSwpPnts = 401 ;
int iDataBytes=1604 ;
int iHeaderBytes=6 ;
FILE *fTraceFile ;
/* Open a HP-IB session at address 18* /
viStatus=viOpenDefaultRM(&defaultRM) ;
viStatus=viOpen(defaultRM,"GPIBO : :18",VI_NULL,VI NULL,&viESA) ;
if(viStatus )
{
printf("Could not open a session to HP-IB device at address 181\n") ;
exit(0) ;
}
/*Clear the instrument * /
viClear(viESA) ;
/*Reset the instrument . This will set number of sweep points to default of 401* /
viPrintf(viESA,"*RST\n") ;
/*Display the program heading * /
printf("\n\t\t Read in Trace Data using 32-bit Real Format (using HP-IB) \n\ n" ) ;
/* Set the input port to the 50MHz amplitude reference* /
Route50MHzSignal() ;
/*Query number of sweep points per trace (firmware revision A .04 .00 and later)* /
/*For firmware revisions prior to A .04 .00, the number of sweep points is 401* /
iSwpPnts=401 ;
viQueryf(viESA,"SENSE :SWEEP :POINTS?\n","%d",&iSwpPnts) ;
/*Calculate number of bytes in the header . The header consists of the "#" sign* /
/*followed by a digit representing the number of digits to follow . The digits * /
/*which follow represent the number of sweep points multiplied by the number * /
/*of bytes per point . * /
iHeaderBytes = 3 ;
/*iDataBytes >3, plus increment for "#" and "n"* /
iDataBytes = (iSwpPnts*iBytesPerPnt) ;
lNumberBytes = iDataBytes ;
while ((iDataBytes = (iDataBytes / 10 )) > 0 )
Chapter 3
3-31

Advertisement

Table of Contents
loading

Table of Contents