180 Chapter 3
Programming Examples
Making Faster Measurements (multiple measurements)
iHeaderLength = 3; /* iArrayLength >0 plus increment for "#" and "n"
*/
while ( (iArrayLength = (iArrayLength / 10)) > 0 ) {
iHeaderLength++;
}
return(iHeaderLength);
}
/******************* prepare ESA for measurement
************************/
void setup() {
viPrintf(viESA, ":SENS:FREQ:CENT %i MHz\n", iCenter);
viPrintf(viESA,":SENS:FREQ:SPAN %i MHZ\n", iSpan);
viPrintf(viESA, ":SENS:BAND %i KHZ\n", iRbw);
/* use the sampling detector for power-average calculations */
viPrintf(viESA, ":DET SAMP\n");
/* Turn off analog output of option board to maximize measurement rate */
viPrintf(viESA, ":SYST:PORT:IFVS:ENAB OFF\n");
/* Turn auto align off to maximize measurement rate */
viPrintf(viESA, ":CAL:AUTO OFF\n");
/* set requested number of points */
viPrintf(viESA, ":SWE:POINTS %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 amplitude reference signal */
viPrintf(viESA, ":CAL:SOUR:STAT ON\n");
/* Identify the instrument and get the model number */
viQueryf(viESA, "*IDN?\n", "%t", &cBuffer);
iResult = (strncmp( cBuffer, hpESA_IDN_E4401B, strlen(hpESA_IDN_E4401B)) &&
strncmp( cBuffer, hpESA_IDN_E4411B, strlen(hpESA_IDN_E4411B)) && strncmp( cBuffer,
hpEMC_IDN_E7401A, strlen(hpEMC_IDN_E7401A)));
if( iResult == 0 )
{
/*Set the input port to the 50MHz amplitude reference for the models*/
/*E4401B, E4411B and E7401A*/