EasyManua.ls Logo

Agilent Technologies EMC Series - Page 182

Agilent Technologies EMC Series
349 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
182 Chapter 3
Programming Examples
Making Faster Measurements (multiple measurements)
/* trace data must point to an integer array of size NUM_POINTS */
memcpy(&cOutBuffer[strlen(cScpiCommand)], ipTraceData, iArrayLength);
memcpy(&cOutBuffer, cScpiCommand, strlen(cScpiCommand));
/* Add a <newline> to the end of the data, This isn’t necessary */
/* if the GPIB card has been configured to assert EOI when the last */
/* character is sent, but it ensures a valid iTermLength is provided. */
cOutBuffer[iArrayLength + strlen(cScpiCommand)] = 0x0A;
iBlockSize = (strlen(cScpiCommand) + iArrayLength + 1);
viWrite(viESA,(ViBuf) cOutBuffer, iBlockSize, &lRetCount );
}
/******* Measure and calculate power-average of multiple measurements
*********/
void average() {
int i=0, iLoop=0;
int iArray[NUM_POINTS];
long lOpc =0L;
double dLogTen = log(10.0);
setup();
iTotalRetCount = lRetCount = 0;
/* start the timer */
ftime( &start_time );
/* Now run through the event loop iNumTraces times */
for(i=0; i<iNumTraces; i++) {
/* trigger a new measurement and wait for complete */
viPrintf(viESA, ":INIT:IMM;*WAI\n");
/* Read the trace data into a buffer */
viPrintf(viESA, ":TRAC:DATA? TRACE1\n");
viRead(viESA,(ViBuf) cInBuffer, (ViUInt32) iBlockSize, &lRetCount );
iTotalRetCount += lRetCount;
/* copy trace data to an array, */
/* byte order swapping could be done here rather than in ESA */
memcpy(iArray, &cInBuffer[iHeaderLength], iArrayLength);
/* calculate a running dPower-average */
for(iLoop = 0; iLoop < NUM_POINTS; iLoop++) {
/* running average of dPower, in milliwatts */

Table of Contents

Other manuals for Agilent Technologies EMC Series

Related product manuals