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

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

Advertisement

Programming Examples
Measuring Harmonic Distortion (GPIB)
/*Read the marker amplitude, this is the fundamental amplitud e
in dBm * /
viQueryf(viESA,"CALC :MARK :Y?\n",'%lf", &fFundaAmptdDbm) ;
/*Change the amplitude units to Volts * /
viPrintf(viESA,"UNIT :POW V \n") ;
/*Read the marker amplitude in volts, This is the fundamental amplitud e
in Volts (necessary for the THD calculation) .* /
viPrintf(viESA,"CALC :MARK :Y?\n") ;
viScanf(viESA,"elf",&dFundaAmptdV) ;
/*Read the marker frequency . * /
viPrintf(viESA,"CALC :MARK :X? \n") ;
viScanf(viESA,'%lf",&dMarkerFreq) ;
dFundamental = dMarkerFreq ;
/*Change the center frequency step size equal to the marker frequency .* /
/*viPrintf(viESA,"CALC :MARK :SET :STEP \n") ; * /
/*Measure each harmonic amplitude as follows : * /
for ( lNum=2 ;lNum<=lMaxHarmonic ;lNum++ )
{
/*Measuring the Harmonic No#[%d] message * /
printf("\n\t Measuring the Harmonic No [%d] \n",lNum ) ;
/*Set the span to 20 MHz* /
viPrintf(viESA,"SENS :FREQ :SPAN 20 MHZ \n") ;
/*Set the center frequency to the nominal harmonic frequency* /
dHarmFreq = lNum*dFUndamental ;
viPrintf(viESA,"SENS :FREQ :CENT %lf HZ \n ;",dHarmFreq) ;
/*Take a sweep and wait for the sweep completion* /
TakeSweep() ;
/*Perform a peak search and wait for completion * /
viPrintf(viESA,"CALC :MARK :MAX\n") ;
/*increase timeout to 60 sec* /
viSetAttribute(viESA,VI ATTR TMO VALUE,60000) ;
/*Activate signal track * /
viPrintf(viESA,"CALC :MARK :TRCK :STAT ON\n") ;
/*Zoom down to a 100 kHz span
*/
Chapter 3
3-75

Advertisement

Table of Contents
loading

Table of Contents