108 Chapter 4
Programming Examples
X-Series Spectrum Analyzer Mode Programing Examples
X-Series Spectrum Analyzer Mode Programing
Examples
The following examples work with Spectrum Analyzer mode. These
examples use one of the following programming languages: Visual
Basic
ÂŽ
6, Visual Basic.NET
ÂŽ
, MS Excel
ÂŽ
, C++, ANSI C, C#.NET, and
Agilent VEE Pro.
These examples are available in either the âprogexamplesâ directory on
the Agilent Technologies Spectrum Analyzer documentation CD-ROM
or the âprogexamplesâ directory in the analyzer. The file names for
each example is listed at the end of the example description. The
examples can also be found on the Agilent Technologies, Inc. web site at
URL:
http://www.agilent.com/find/sa_programming
NOTE These examples have all been tested and validated as functional in the
Spectrum Analyzer mode. They have not been tested in all other modes.
However, they should work in all other modes except where exceptions
are noted.
Programming using Visual Basic
ÂŽ
6, Visual Basic.NET
ÂŽ
and MS
Excel
ÂŽ
:
âĸ Transfer Screen Images from your Spectrum Analyzer using Visual
Basic 6
This example program stores the current screen image on the
instrument flash memory as âD:\PICTURE.PNGâ. It then transfers
the image over GPIB or LAN and stores the image on your PC in the
current directory as âPICTURE.PNGâ. The file âD:\PICTURE.PNGâ is
then deleted on the instrument flash memory.
File name: _screen.bas
âĸ Binary Block Trace data transfer from your Spectrum Analyzer
using Visual Basic 6
This example program queries the IDN string from the instrument
and then reads the trace data in Spectrum Analysis mode in binary
format (Real,32 or Real,64 or Int,32). The data is then stored to a file
âbintrace.txtâ. This data transfer method is faster than the
default ASCII transfer mode, because less data is sent over the bus.
File name: bintrace.bas
Programming using C++, ANSI C and C#.NET:
âĸ Serial Poll for Sweep Complete using C++