SPRING :: NOTE
[Agilent] N9320B Spectrum Analizer Source (Measuring Phase Noise) 본문
Development Tools/Keysight · National Instruments
[Agilent] N9320B Spectrum Analizer Source (Measuring Phase Noise)
RAYZIE 2016. 2. 29. 18:46반응형
/************************************************************/
/* Measuring Phase Noise */
/* */
/* This example is for the N9320B Spectrum Analyzers */
/* */
/* This C programming example does the following. */
/* The SCPI instrument commands used are given as reference. */
/* */
/* - Opens a USB session */
/* - Clears the Analyzer */
/* - Resets the Analyzer */
/* *RST */
/* - Sets the center frequency and span */
/* SENS:FREQ:CENT 50 MHZ */
/* SENS:FREQ:SPAN 10 MHZ */
/* - Set the input port to the 50 MHz amplitude reference */
/* CAL:SOUR:STAT ON */
/* - Set the marker to the maximum peak */
/* CALC:MARK1:MAX */
/* - Activate the phase noise function */
/* CALC:MARK1:PHN ON*/
/* - Set offset to 20 kHz */
/* CALC:PHN:OFFS 20KHz */
/* - Query the phase noise */
/* CALC:MARK:PHN:Y? */
/* - Close the session */
/************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#include "visa.h"
ViSession defaultRM, viN9320B;
ViStatus errStatus;
ViChar cIdBuff[256]= {0};
char cEnter = 0;
int iResult = 0;
/*Set the input port to 50 MHz amplitude reference*/
void Route50MHzSignal()
{
viQueryf(viN9320B, "*IDN?\n", "%t", &cIdBuff);
/* prompt the user*/
/* to connect the amplitude reference output to the input*/
printf ("Connect CAL OUT to the RF IN \n");
printf ("......Press Return to continue \n");
scanf( "%c",&cEnter);
/*Externally route the 50 MHz Signal*/
viPrintf(viN9320B,"CAL:SOUR:STAT ON \n");
}
void main()
{
/*Program Variables*/
ViStatus viStatus = 0;
double dMarkAmp =0.0;
/*Open a USB session*/
viStatus=viOpenDefaultRM(&defaultRM);
// USB0::2391::8472::9876543210::0::INSTR --> YOUR VISA ADDRESS
viStatus=viOpen(defaultRM,"USB0::2391::8472::9876543210::0::INSTR",VI_NULL,VI_NULL,&viN9320B);
if(viStatus)
{
printf("Could not open a session to USB device!\n");
exit(0);
}
/*Clear the Instrument*/
viClear(viN9320B);
/*Reset the Instrument*/
viPrintf(viN9320B,"*RST\n");
/*Display the program heading */
printf("\n\t\t Noise Program \n\n" );
/* Check for the instrument model number and route the 50 MHz
signal accordingly*/
Route50MHzSignal();
/*Set the analyzer center frequency to 50 MHz*/
viPrintf(viN9320B,"SENS:FREQ:CENT 50e6\n");
/*Set the analyzer span to 10 MHz*/
viPrintf(viN9320B,"SENS:FREQ:SPAN 10e6\n");
/*Set the marker to the maximum peak*/
viPrintf(viN9320B,"CALC:MARK1:MAX \n");
/*Activate the noise marker function.*/
viPrintf(viN9320B,"CALC:MARK1:PHN ON \n");
/*Set the offset to 20 kHz. This places the
active marker two divisions to the right of the input signal.*/
viPrintf(viN9320B,":CALC:PHN:OFFS 20KHz \n");
/*Query and read the phase noise from the analyzer */
viQueryf(viN9320B,":CALC:MARK:PHN:Y? \n","%lf",&dMarkAmp);
/*Report the phase nosie */
printf("\t Marker Amplitude =%lf dBc/Hz\n",dMarkAmp);
/*Close the session*/
viClose(viN9320B);
viClose(defaultRM);
}
반응형
'Development Tools > Keysight · National Instruments' 카테고리의 다른 글
Comments