Specifications

Chapter 18 281
PSA Programming Examples
Using C with Marker Peak Search and Peak Excursion Measurement
Routines
PSA Programming Examples
void main()
{
/*Program Variables*/
ViStatus viStatus = 0;
char cEnter = 0;
int iResult = 0;
double dMarkerFreq = 0;
double dMarkerAmpl = 0;
float fPeakExcursion =0;
long lOpc = 0L;
char *psaSetup = // PSA setup initialization
":INST SA;" // Change to Spectrum Analysis mode
"*RST;*CLS;" // Reset the device and clear status
":SENS:FREQ:CENT 50 MHz;"// Set center freq to 50 MHz
":SENS:FREQ:SPAN 50 MHz;"// Set freq span to 50 MHz
":SENS:FEED AREF;"// Set input port to internal 50 MHz ref
":INIT:CONT 0;"// Set analyzer to single sweep mode
":CALC:MARK:PEAK:THR -90";// Set the peak thresold to -90 dBm
/*Open a GPIB session at address 18.*/
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM,"GPIB0::18",VI_NULL,VI_NULL,&viPSA);
if(viStatus)
{
printf("Could not open a session to GPIB device at address 18!\n");
exit(0);
}
/*Display the program heading */
printf("\n\t\t Marker Program \n\n" );
/* Send setup commands to instrument */
viPrintf(viPSA,"%s\n",psaSetup);