Specifications

282 Chapter 18
PSA Programming Examples
Using C with Marker Peak Search and Peak Excursion Measurement
Routines
PSA Programming Examples
/*User enters the peak excursion value */
printf("\t Enter PEAK EXCURSION level in dBm: ");
scanf( "%f",&fPeakExcursion);
/*Set the peak excursion*/
viPrintf(viPSA,"CALC:MARK:PEAK:EXC %1fDB \n",fPeakExcursion);
/*Trigger a sweep and wait for completion*/
viPrintf(viPSA,"INIT:IMM;*WAI\n");
/*Set the marker to the maximum peak*/
viPrintf(viPSA,"CALC:MARK:MAX \n");
/*Query and read the marker frequency*/
viQueryf(viPSA,"CALC:MARK:X? \n","%lf",&dMarkerFreq);
printf("\n\t RESULT: Marker Frequency is: %lf MHz \n\n",dMarkerFreq/10e5);
/*Query and read the marker amplitude*/
viQueryf(viPSA,"CALC:MARK:Y?\n","%lf",&dMarkerAmpl);
printf("\t RESULT: Marker Amplitude is: %lf dBm \n\n",dMarkerAmpl);
/*Close the session*/
viClose(viPSA);
viClose(defaultRM);
}