180 Chapter 3
ProgrammingExamples
Making Faster Measurements (multiple measurements)
iHeaderLength = 3; /* iArrayLength >0 plus increment for "#" and "n"
*/
while ( (iArrayLength = (i ArrayLength / 10)) > 0 ) {
iHeaderLength++;
}
return(iHeaderLength);
}
/******************* prepare ESA for measurement
************************/
void setup() {
viPrintf(viESA, ":SENS:FRE Q:CENT %i MHz\n", iCenter);
viPrintf(viESA,":SENS:FREQ :SPAN %i MHZ\n", iSpan);
viPrintf(viESA, ":SENS:BAN D %i KHZ\n", iRbw);
/* use the sampling detector for power-average ca lculations */
viPrintf(viESA, ":DET SAMP \n");
/* Turn off analog output of option board to maximize measurement rate */
viPrintf(viESA, ":SYST:POR T:IFVS:ENAB OFF\n");
/* Turn auto align off to maximi ze measurement rate */
viPrintf(viESA, ":CAL:AUTO OFF\n");
/* set requested num ber of points */
viPrintf(viESA, ":SWE:POIN TS %i\n", NUM_POINTS);
printf("This program will measure and calculate\n");
printf ("the power average of %i%i-point
traces.\n",iNumTraces,iNumPoints);
/* Turn on 50 MHz amplitud e reference signal */
viPrintf(viESA, ":CAL:SOUR :STAT ON\n");
/* Identify the instrument and g et the model number */
viQueryf(viESA, "*IDN?\n", "%t", &cBuffer);
iResult = (strncmp( cBuffer, hpESA_IDN_E4401B, strlen(hpESA_IDN_E4401B)) &&
strncmp( cBuffer, hpESA_IDN_E4411B, s trlen(hpESA_IDN_E4411B)) && strncmp( cBuffer,
hpEMC_IDN_E7401A, strlen(hpEMC_IDN_E7 401A)));
if( iResult == 0 )
{
/*Set the input port to the 50MH z amplitude reference for the mode ls*/
/*E4401B, E4411B and E7401A*/