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

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)
/*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 >0, plus increment for "#" and "n" * /
iDataBytes = (iSwpPnts*iBytesPerPnt) ;
lNumberBytes = iDataBytes ;
while ((iDataBytes = (iDataBytes / 10 )) > 0 )
{
iHeaderBytes++ ;
}
/*Set analyzer to single sweep mode * /
viPrintf(viESA,"INIT :CONT 0 \n " ) ;
/* Set the analyzer to 50MHz-center frequency * /
viPrintf(viESA,"SENS :FREQ :CENT 50 MHZ\n") ;
/*Set the analyzer to 50MHz Span * /
viPrintf(viESA,"SENS :FREQ :SPAN 50 MHZ\n") ;
/* Specify dB per division of each vertical division & Units * /
viPrintf(viESA,"DISP :WIND :TRAC :Y :SCAL :PDIV 10dB\n") ;
viPrintf(viESA,"UNIT :POW DBM\n") ;
/*Set analyzer trace data format to 32-bit Real * /
viPrintf(viESA,"FORM :DATA REAL,32\n") ;
/*Set the binary byte order to SWAP * /
viPrintf(viESA, "FORM :BORD SWAP\n") ;
/*Trigger a sweep * /
viPrintf(viESA,"INIT :IMM\n") ;
/*Read the operation complete query * /
viQueryf(viESA, "*OPC?\n", "%d" , &lOpc) ;
if (!]Opc )
{
printf("Program Abort( error ocurred : last command was not completed!\n") ;
exit(0) ;
}
/*Calculate size of trace record . This will be the sum of HeaderBytes, Number* /
/*Bytes (the actual data bytes) and the "\n" terminator* /
iSize = lNumberBytes + iHeaderBytes + 1 ;
3-42
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents