
Chapter 3
135
Programming Examples
Saving ASCII Trace Data in an ASCII File
/*query the spectrum trace information*/
viPrintf(viVSA, "FETCH:SPEC1?\n");
/*save the info trace to buffer*/
viRead (viVSA,(ViBuf)sTraceInfo,256,&lBytesRetrieved);
/*query the spectrum trace data*/
viPrintf(viVSA, "FETCH:SPEC7?\n");
/*save the spectrum trace data to buffer*/
viRead (viVSA,(ViBuf)sTraceBuffer,1024*100,
&lBytesRetrieved);
/*set the instrument back to continuous mode*/
viPrintf(viVSA, "INIT:CONT 1\n");
/*save trace data to an ASCII file*/
fTraceFile=fopen("C:\\HPE4406ATraceASCII.txt",
"w");
fprintf(fTraceFile,"HPE4406ATraceASCII.exe
Output\nHewlett-Packard 1998\n\n");
fprintf(fTraceFile,"Please refer to the PROGRAMMER'S
GUIDE to read about: FETCH:SPEC[n]\n\n");
fprintf(fTraceFile,"The trace information:n=1\n----
------------------------\n");
fprintf(fTraceFile,sTraceInfo);
fprintf(fTraceFile,"\n\nThe averaged spectrum trace
data:n=7\n----------------------------\n\n");
fprintf(fTraceFile,sTraceBuffer);
fprintf(fTraceFile,"\n----------------------------\nEnd
of the trace data");
fclose(fTraceFile);
/*print message to the standard output*/
printf("The spectrum information was saved to
C:\\HPE4406ATraceASCII.txt file\n\n");
/* close session */
viClose (viVSA);
viClose (defaultRM);
}
Summary of Contents for E4406A VSA Series
Page 4: ...4 ...
Page 59: ...59 2 Programming Fundamentals ...
Page 124: ...124 Chapter2 Programming Fundamentals Using the LAN to Control the Analyzer ...
Page 125: ...125 3 Programming Examples ...
Page 164: ...164 Chapter3 Programming Examples Using Java Programming Over Socket LAN ...
Page 165: ...165 4 Programming Command Cross References ...
Page 379: ...379 6 Error Messages ...
Page 412: ...412 Chapter6 Error Messages Error Message Descriptions ...