HP ESA-E Series Programmer's Manual page 146

Esa spectrum analyzers
Table of Contents

Advertisement

Programming Examples
Measuring Harmonic Distortion (RS-232)
/* Open a serial session at COM1 */
viStatus=viOpenDefaultRM(&defaultRM);
if (viStatus =
viOpen(defaultRM,"ASRL1::INSTR",VI_NULL,VI_NULL,&viESA) !=
VI_SUCCESS)
{
printf("Could not open a session to ASRL device at
COM1!\n");
exit(0);
}
/*Clear the analyzer*/
viClear(viESA);
/*Reset the analyzer*/
viPrintf(viESA,"*RST\n");
/*Display the program heading */
printf("\n\t\t Harmonic Distortion Program \n\n" );
/* Check for the analyzer model number and route the
50 MHz signal accordingly*/
Route50MHzSignal();
/*Set the analyzer center frequency to the fundamental
frequency. */
viPrintf(viESA,"SENS:FREQ:CENT %lf MHz
\n;",dFundamental);
/*Set the analyzer to 10 MHz Span */
viPrintf(viESA,"SENS:FREQ:SPAN 10 MHZ\n");
/*Put the analyzer in a single sweep mode */
viPrintf(viESA,"INIT:CONT 0 \n");
/*Trigger a sweep*/
viPrintf(viESA,"INIT:IMM\n");
/*Check for operation complete*/
viQueryf(viESA, "*OPC?\n", "%d", &lOpc);
if (!lOpc)
{
printf("Program Abort! Error occurred: last command
was not completed !\n");
exit(0);
}
/*Perform a peak search */
viPrintf(viESA,"CALC:MARK:MAX
/* Place the signal at the reference level using the
marker-to-reference level command and take sweep */
viPrintf(viESA,"CALC:MARK:SET:RLEV \n");
3-82
\n");
Chapter 3

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents