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

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

Advertisement

Programming Example s
Reading Trace Data Using ASCII Format (RS-232)
/*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 (llOpc )
{
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? TRACE]." , &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",1Count+l,cToken) ;
while (cToken != NULL )
{
lCount++ ;
cToken =strtok(NULL,",") ;
if (lCount != iSwpPnts )
fprintf(fTraceFile,"\tAmplitude of point[%d] = % s
dBm\n",lCount+l,cToken) ;
}
fprintf(fTraceFile,"\nThe Total trace data points of the spectrum are :[%d ]
\n\n",1Count) ;
Chapter 3
3-37

Advertisement

Table of Contents
loading

Table of Contents