142 Chapter 3
ProgrammingExamples
Measuring Noise
#include <math.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#include "visa.h"
#define hpESA_IDN_E4401B "Hewlett -Packard, E4401B"
#define hpESA_IDN_E4411B "Hewlett -Packard, E4411B"
#definehpEMC_IDN_E7401A "Hewlett-Pa ckard, E7401A"
ViSession defaultRM, viESA;
ViStatus errStatus;
ViChar cIdBuff[256]= {0};
char cEnter = 0;
int iResult = 0;
long lOpc =0L;
/*Set the input port to 50MHz ampl itude reference*/
void Route50MHzSignal()
{
viQueryf(viESA, "*IDN?\n", "%t", & cIdBuff);
iResult = (strncmp( cIdBuff, hpESA _IDN_E4401B, strlen(hpESA_IDN_E440 1B)) &&
strncmp( cIdBuff, hpESA_IDN_E4411B, s trlen(hpESA_IDN_E4411B)) && strncmp( cIdBuff,
hpEMC_IDN_E7401A, strlen(hpEMC_IDN_E7 401A)));
if( iResult == 0 )
{
/*Set the input port to the 50MHz amplitude reference for the models */
/*E4401B, E4411B amd E7401A*/
viPrintf(viESA,"CAL:SOUR:STAT ON \ n");
}
else
{
/* For the analyzers having freque ncy limits >= 3GHz, prompt the use r*/
/* to connect the amplitude refere nce output to the input*/
printf ("Connect AMPTD REF OUT to the INPUT \n");
printf ("......Press Return to continue \n");
scanf( "%c",&cEnter);
/*Externally route the 50MHz Signa l*/
viPrintf(viESA,"CAL:SOUR:STAT ON \ n");
}
}
void main()
{