EasyManua.ls Logo

HP ESA-E Series - Page 147

HP ESA-E Series
398 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 3 3-83
Programming Examples
Measuring Harmonic Distortion (RS-232)
/*Trigger a sweep */
viPrintf(viESA,"INIT:IMM\n");
/*Check for operation complete */
viQueryf(viESA, "*OPC?\n", "%d", &lOpc);
if (!lOpc)
{
/*Perform a peak search */
viPrintf(viESA,"CALC:MARK:MAX \n");
/*Perform activate signal track */
viPrintf(viESA,"CALC:MARK:TRCK:STAT ON \n");
/*Perform narrow span and wait */
viPrintf(viESA,"SENS:FREQ:SPAN 10e4 \n");
/*Make sure the previous command has been completed */
viQueryf(viESA, "*OPC?\n", "%d", &lOpc);
if (!lOpc)
{
printf("Program Abort! Error occurred: last command
was not completed! \n");
exit(0);
}
/*De-activate the signal track */
viPrintf(viESA,"CALC:MARK:TRCK:STAT OFF \n");
/*Set units to DBM*/
viPrintf(viESA,"UNIT:POW DBM \n");
/*Take a sweep and wait for the sweep completion*/
TakeSweep();
/*Perform a peak search */
viPrintf(viESA,"CALC:MARK:MAX \n");
/*Take a sweep and wait for the sweep completion*/
TakeSweep();
/*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");
/*Take a sweep and wait for the sweep completion*/
TakeSweep();
/*Read the marker amplitude in volts, This is the
fundamental amplitude in volts (necessary for the THD

Table of Contents

Related product manuals