HP ESA-E Series Programmer's Manual page 90

Esa spectrum analyzers
Table of Contents

Advertisement

Programming Examples
Reading Trace Data using ASCII Format (HP-IB)
/*Trigger a sweep*/
viPrintf(viESA,"INIT:IMM; \n");
/*Read the operation complete query*/
viQueryf(viESA, "*OPC?\n", "%d", &lOpc);
if (!lOpc)
{
printf("Program Abort! error ocurred: last command was
not completed!\n");
exit(0);
}
/*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 file by removing the ","
token*/
fTraceFile=fopen("C:\\temp\\ReadAscHpib.txt","w");
fprintf(fTraceFile,"ReadAscHpib.exe
Output\nHewlett-Packard 1999\n\n");
fprintf(fTraceFile,"\tAmplitude of point[%d] = %s
dBm\n",lCount+1,cToken);
while (cToken != NULL)
{
lCount++;
cToken =strtok(NULL,",");
if (lCount != 401)
fprintf(fTraceFile,"\tAmplitude of point[%d] =
%s dBM\n",lCount+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);
}
3-26
Chapter 3

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents