EasyManua.ls Logo

Agilent Technologies E4406A VSA Series User Manual

Agilent Technologies E4406A VSA Series
420 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #132 background imageLoading...
Page #132 background image
132 Chapter3
Programming Examples
Saving Binary Trace Data in an ASCII File
/*set the binary byte order to SWAP*/
viPrintf(viVSA, "FORM:BORD SWAP\n");
/*trigger a spectrum measurement*/
viPrintf(viVSA, "MEAS:SPEC?;*OPC?\n");
/*poll the operation complete query*/
while (!lComplete)
viScanf (viVSA,"%d",&lComplete);
/*query the spectrum trace data*/
viPrintf(viVSA, "FETCH:SPEC7?\n");
/*set the instrument back to continuous mode*/
viPrintf(viVSA, "INIT:CONT 1\n");
/*get trace header data, in this case we know it's 6
bytes of format #DNNNNN */
viRead (viVSA,(ViBuf)sTraceBuffer,6,&lBytesRetrieved);
/*Extract the number of bytes from the trace header*/
memcpy(sBufferInfo,sTraceBuffer+2,4);
lNumberBytes = atoi(sBufferInfo);
/*calculate the number of points given the number of
bytes in the trace - REAL 64 binary format means each
number is represented by 8 bytes*/
lNumberPoints = lNumberBytes/8;
/*get and save trace in a buffer*/
viRead (viVSA,(ViBuf)sTraceBuffer,lNumberBytes,
&lBytesRetrieved);
/*copy the trace buffer to the array of real*/
memcpy(adTraceArray,sTraceBuffer,(size_t)lNumberBytes);
/*save trace data to an ASCII file*/
fTraceFile=fopen("C:\\HPE4406ATrace.txt","w");
fprintf(fTraceFile,"HPE4406ATrace.exe Output\nAgilent
1998\n\n");
fprintf(fTraceFile,"List of %d points of the averaged
spectrum trace:\n\n",lNumberPoints);
for (long i=0;i<lNumberPoints;i++)
fprintf(fTraceFile,"\tAmplitude of point[%d] =
%.2lf dBm\n",i+1,adTraceArray[i]);
fclose(fTraceFile);
/*print message to the standard output*/
printf("The %d trace points were saved to
C:\\HPE4406ATrace.txt file\n\n",lNumberPoints);
/* close session */
viClose (viVSA);
viClose (defaultRM);
}

Table of Contents

Other manuals for Agilent Technologies E4406A VSA Series

Question and Answer IconNeed help?

Do you have a question about the Agilent Technologies E4406A VSA Series and is the answer not in the manual?

Agilent Technologies E4406A VSA Series Specifications

General IconGeneral
BrandAgilent Technologies
ModelE4406A VSA Series
CategoryTest Equipment
LanguageEnglish

Summary

Safety Information

Front Panel Error Messages Annunciators

Describes status indicators for transmitter tester functions and error conditions.

1 Preparing for Use

Programming the Transmitter Tester

Explains how to program the E4406A VSA Series Transmitter Tester.

Installing Optional Measurement Personalities

Details the two-step process for installing measurement personalities.

Cables for Connecting to RS-232

Describes various cables and adapters for connecting to PCs and printers via RS-232.

Connecting to a LAN Server

Explains how to connect to a LAN server for instrument control.

2 Programming Fundamentals

SCPI Language Basics

Introduces the SCPI programming language and its core concepts.

Using the Instrument Status Registers

Explains how to monitor instrument hardware and firmware events using status registers.

Overview of the GPIB Bus

Explains the fundamentals of the GPIB instrument nomenclature and command statements.

Using the LAN to Control the Analyzer

Covers various methods to control the analyzer via LAN connection.

3 Programming Examples

Using Markers

Demonstrates how to use markers in a C programming example.

Saving Binary Trace Data in an ASCII File

Provides a C programming example for saving binary trace data to an ASCII file.

Using C Programming Over Socket LAN

Demonstrates simple socket programming using C for analyzer control.

4 Programming Command Cross References

Functional Sort of SCPI Commands

Organizes SCPI commands by function for easier reference.

5 Language Reference

SCPI Command Subsystems

Lists and describes various SCPI command subsystems available in the instrument.

Common IEEE Commands

Details commands specified in IEEE Standard 488.2 for instrument control.

6 Error Messages

Error Queues

Explains the instrument's history and SCPI remote interface error queues.

Error Message Descriptions

Provides descriptions for unnumbered, query, device-specific, execution, and command errors.

Related product manuals