Agilent Technologies Model A.08.xx Water Dispenser User Manual


 
174 Chapter 3
Programming Examples
Measuring Harmonic Distortion (RS-232)
viPrintf(viESA,"CALC:MARK:SET:RLEV\n");
/*Trigger a sweep, wait for sweep completion*/
viPrintf(viESA,"INIT:IMM;*WAI\n");
/*Perform a peak search */
viPrintf(viESA,"CALC:MARK:MAX\n");
/*Increase timeout to 60 sec*/
viSetAttribute(viESA,VI_ATTR_TMO_VALUE,60000);
/*Perform activate signal track */
viPrintf(viESA,"CALC:MARK:TRCK:STAT ON\n");
/*Take a sweep and wait for the sweep completion*/
TakeSweep();
/*Perform narrow span and wait */
viPrintf(viESA,"SENS:FREQ:SPAN 10e4\n");
/*Take a sweep and wait for the sweep completion*/
TakeSweep();
/*De activate the signal track */
viPrintf(viESA,"CALC:MARK:TRCK:STAT OFF\n");
/*Reset timeout to 3 sec*/
viSetAttribute(viESA,VI_ATTR_TMO_VALUE,3000);
/*Set units to dBm*/
viPrintf(viESA,"UNIT:POW DBM\n");
/*Perform a peak search */
viPrintf(viESA,"CALC:MARK:MAX\n");
/*Read the marker amplitude, this is the fundamental amplitude
in dBm */
viQueryf(viESA,"CALC:MARK:Y?\n","%1f", &fFundaAmptdDbm);
/*Change the amplitude units to Volts */
viPrintf(viESA,"UNIT:POW V\n");
/*Read the marker amplitude in volts, This is the fundamental amplitude
in Volts (necessary for the THD calculation).*/
viQueryf(viESA,"CALC:MARK:Y?\n","%lf",&dFundaAmptdV);