130
Chapter 3
Programming Examples
Saving Binary Trace Data in an ASCII File
Saving Binary Trace Data in an ASCII File
This C programming example (HPE4406Trace.c):
• uses the VISA library for input/output, opens a session to a GP-IB
device at address 18 and presets the instrument.
• sets the input to the internal 50 MHz reference source and tunes the
instrument to the signal.
• sets the instrument to single measurement mode.
• selects binary data output format and sets the binary byte order to
SWAP.
• initiates a spectrum measurement and waits for the operation to
complete.
• sets the instrument back to continuous measurement mode and
queries the trace data.
• calculates the number of points in the trace by:
1. getting the trace header data. (In this case it’s 6 digits,
#DNNNNN.)
2. extracting the information on the number of bytes in the data
block of data from the trace header.
3. calculating the number of trace points given the number of bytes
in the trace. (REAL,64 binary format means each number is
represented by 8 bytes.) See
“Block Program Data” on page 65
of
the section on “SCPI Language Basics” for more details on this
process.
• Gets and saves the trace in a buffer
• Copies the trace buffer to the array of real numbers
• Saves the trace data to an ASCII file
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 ...