Agilent Technologies ESA-E Series Programmer's Manual page 92

Esa spectrum analyzers
Hide thumbs Also See for ESA-E Series:
Table of Contents

Advertisement

/*Trigger a spectrum measurement*/
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);
}
/*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 spectrum measurement*/
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 to a 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 (lCount != iSwpPnts)
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);
Chapter 3
Programming Examples
Reading Trace Data Using ASCII Format (RS-232)
3-37

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents