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

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 (RS-232 )
}
}
void main( )
{
/*Program Variables* /
ViStatus viStatus= 0 ;
ViChar VI FAR cResult[1024000] = {0} ;
ViReal32 dTraceArray[1024] = {0} ;
char cBufferInfo[7]= {0} ;
long 1NumberBytes =0L ;
long lOpc =OL ;
unsigned long 1RetCount = OL ;
int iSize = 0 ;
/*BytesPerPnt is 4 for Rea132 or Int32 formats, 8 for Rea164, and 2 for Uintl6* /
int iBytesPerPnt = 4 ;
int iSwpPnts = 401 ; /*Number of points per sweep* /
int iDataBytes = 1604 ;/*Number of data points, assuming 4 bytes per point* /
int iHeaderBytes = 6 ; /*Number of bytes in the header, assuming 1604 data bytes* /
FILE *fTraceFile ;
/* Open a serial session at COM1 *1
viStatus=viOpenDefaultRM(&defaultRM) ;
if (viStatus =viOpen(defaultRM,"ASRLI : :INSTR",VI_NULL,VI_NULL,&viESA) ! _
VI_SUCCESS )
{
printf("Could not open a session to ASRL device at COM1!1\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
ASCII
Format (using RS-232) Program \n\n "
) ;
/* Set the input port to the internal 50MHz reference source * /
Route50MHzSignal() ;
/*Query number of sweep points per trace (firmware revision A .04 .00 or 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) ;
Chapter 3
3-41

Advertisement

Table of Contents
loading

Table of Contents