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

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

Advertisement

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 spectrum measurement* /
viPrintf(viESA,"INIT :IMM\n") ;
/*Read the operation complete query
*1
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* /
v1krintf(viESA,"INIi :Ii
n \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? 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\\ReadAscHpib .txt","w") ;
fprintf(fTraceFile,"ReadAscHpib .exe Output\nHewlett-Packard 1999\n\n") ;
fprintf(fTraceFile,"\tAmplitude of point[%d] = %s dBm\n",lCount+l,cToken) ;
while (cToken != NULL )
{
lCount++ ;
cToken =strtok(NULL,",") ;
if (lCount != iSwpPnts )
Chapter 3
3-27

Advertisement

Table of Contents
loading

Table of Contents