HP ESA-E Series Programmer's Manual page 98

Esa spectrum analyzers
Table of Contents

Advertisement

Programming Examples
Reading Trace Data Using ASCII Format (RS-232)
/*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 "," token 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\\ReadAscRS232.txt","w");
fprintf(fTraceFile,"ReadAscRS232.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 (1Count != 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-34
Chapter 3

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents