Specifications
272 Chapter 17 
ESA Programming Examples
Using C to Make Faster Power Averaging Measurements
ESA Programming Examples
***********************/
int HeaderLength(int iArrayLength)  {
  int iHeaderLength;
 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 )










