144 Chapter 3
Programming Examples
Measuring Noise
}
/*Set the analyzer in a single sweep mode*/
viPrintf(viESA,"INIT:CONT 0 \n");
/*Trigger a spectrum measurement*/
viPrintf(viESA,"INIT:IMM \n");
/*Set the analyzer in active delta marker mode*/
viPrintf(viESA,"CALC:MARK:MODE DELT \n");
/*Set the marker delta frequency to 2 MHz. This places the
active marker two divisions to the right of the input signal.*/
viPrintf(viESA,"CALC:MARK:X 2E+6 \n");
/*Activate the noise marker function.*/
viPrintf(viESA,"CALC:MARK:FUNC NOIS \n");
/*Trigger a sweep and wait for sweep completion*/
viPrintf(viESA,"INIT:IMM;*WAI \n");
/*Query and read the marker delta amplitude from the analyzer*/
viQueryf(viESA,"CALC:MARK:Y? \n","%lf",&dMarkAmp);
/*Report the marker delta amplitude as the carrier-to-noise ratio in dBc/Hz*/
printf("\t Marker Amplitude = %lf dBc/Hz\n",dMarkAmp);
/*Close the session*/
viClose(viESA);
viClose(defaultRM);
}