Specifications
290 Chapter 18
PSA Programming Examples
Using C to Save Binary Trace Data
PSA Programming Examples
sBuffer[lLength] = 0; /* append a null to byte count */
printf("%s\n",sBuffer); /* print error buffer to display */
} while (sBuffer[1] != ’0’);
/* set the analyzer to continuous mode for manual use */
viPrintf(viPSA, "INIT:CONT 1\n");
/*save trace data to an ASCII file*/
fTraceFile=fopen("C:\\Trace.txt","w");
fprintf(fTraceFile,"Trace.exe Output\nAgilent Technologies 2001\n\n");
fprintf(fTraceFile,"List of %d points of the averaged spectrum
trace:\n\n",lNumberPoints);
for (i=0;i<lNumberPoints;i++)
fprintf(fTraceFile,"\tAmplitude of point[%d] = %.2lf
dBm\n",i+1,adTraceArray[i]);
fclose(fTraceFile);
/*print message to the standard output*/
printf("The %d trace points were saved to C:\\Trace.txt
file\n\n",lNumberPoints);
/* Send message to standard output */
printf("\nPress Enter to set analyzer’s input port back to RF.\n");
scanf("%c",&dummyvar);
/* set the input port to RF */
viPrintf(viPSA, "feed rf\n");
/* Close session */
viClose (viPSA);
viClose (defaultRM);
}