
Chapter 3
119
Programming Examples
Reading Trace Data using ASCII Format (GPIB)
viPrintf(viESA,"SENS:FREQ:SPAN 50 MHz\n");
/*Set the analyzer to single sweep mode */
viPrintf(viESA,"INIT:CONT 0 \n");
/*Trigger a sweep and wait for sweep to complete */
viPrintf(viESA,"INIT:IMM;*WAI\n");
/* Specify units in dBm*/
viPrintf(viESA,"UNIT:POW DBM \n");
/*Set analyzer trace data format to ASCII Format*/
viPrintf(viESA,"FORM:DATA ASC \n");
/*Trigger a sweep and wait for sweep to complete */
viPrintf(viESA,"INIT:IMM;*WAI\n");
/*Query the Trace Data using ASCII Format */
viQueryf(viESA,"%s\n", "%#t","TRAC:DATA? TRACE1" , &iNum , cResult);
/*Remove the "," from the ASCII trace data for analyzing data*/
cToken = strtok(cResult,",");
/*Save trace data to an ASCII to a file, by removing the "," token*/
fTraceFile=fopen("C:\\temp\\ReadAscGpib.txt","w");
fprintf(fTraceFile,"ReadAscGpib.exe Output\nAgilent Technologies 2000\n\n");
fprintf(fTraceFile,"\tAmplitude of point[%d] =
%
s dBm\n",1,cToken);
while (cToken != NULL)
{
+;
cToken =strtok(NULL,",");
if (lCount != iSwpPnts)
fprintf(fTraceFile,"\tAmplitude of point[%d] =
%
s
dBm\n",1,cToken);
}
fprintf(fTraceFile,"\nThe Total trace data points of the spectrum are
:
[%d]
\n\n",lCount);
fclose(fTraceFile);
/*Close the session*/
viClose(viESA);
viClose(defaultRM);
}
Содержание E7401A
Страница 36: ...36 Commands Alphabetical Listing ...
Страница 92: ...92 Chapter 2 Status Registers Use Status Registers to Determine the State of Analyzer Events and Conditions ...
Страница 185: ...185 4 Programming Command Cross References ...
Страница 283: ...Chapter 5 283 Language Reference SENSe DETector Subsection Figure 5 4 Auto Rules of Detector Selection ...
Страница 339: ...339 6 Agilent 8590 EMC Analyzers Programming Conversion Guide ...