Hewlett-Packard Company
Lightwave Operations
1400 Fountaingrove Parkway
Santa Rosa, CA 95403-1799,
USA
(707) 577-1400
Notice.
The information contained in
this document is subject to
change without notice. Companies, names, and data used
in examples herein are fictitious unless otherwise noted.
Hewlett-Packard makes no
warranty of any kind with
regard to this material, including but not limited to, the
implied warranties of merchantability and fitness for a
particular purpose. HewlettPackard shall not be liable for
errors contained herein or for
incidental or consequential
damages in connection with
the furnishing, performance,
or use of this material.
Restricted Rights Legend.
Use, duplication, or disclosure by the U.S. Government
is subject to restrictions as set
forth in subparagraph (c) (1)
(ii) of the Rights in Technical
Data and Computer Software
clause at DFARS 252.227-7013
for DOD agencies, and subparagraphs (c) (1) and (c) (2)
of the Commercial Computer
Software Restricted Rights
clause at FAR 52.227-19 for
other agencies.
Safety Symbols.
CAUTION
The
caution
sign denotes a
hazard. It calls attention to a
procedure which, if not correctly performed or adhered
to, could result in damage to
or destruction of the product.
Do not proceed beyond a caution sign until the indicated
conditions are fully understood and met.
WARNING
The
warning
sign denotes a
hazard. It calls attention to a
procedure which, if not correctly performed or adhered
to, could result in injury or
loss of life. Do not proceed
beyond a warning sign until
the indicated conditions are
fully understood and met.
The instruction manual symbol. The product is marked with this
warning symbol when
it is necessary for the
user to refer to the
instructions in the
manual.
The laser radiation
symbol. This warning
symbol is marked on
products which have a
laser output.
The AC symbol is used
to indicate the
required nature of the
line module input
power.
The ON symbols are
|
used to mark the positions of the instrument
power line switch.
The OFF symbols
❍
are used to mark the
positions of the instrument power line
switch.
The CE mark is a registered trademark of
the European Community.
The CSA mark is a registered trademark of
the Canadian Standards Association.
This text denotes the
ISM1-A
instrument is an
Industrial Scientific
and Medical Group 1
Class A product.
Typographical Conventions.
The following conventions are
used in this book:
Key type
for keys or text
located on the keyboard or
instrument.
Softkey type
for key names that
are displayed on the instrument’s screen.
Display type
for words or
characters displayed on the
computer’s screen or instrument’s display.
User type
for words or charac-
ters that you type or enter.
Emphasis
type for words or
characters that emphasize
some point or that are used as
place holders for text that you
type.
ii
The HP 8702D—At a Glance
The HP 8702D—At a Glance
HP 8702D Programmer’s Guide
The
ment. The programming syntax conforms to the
tal Interface for Programmable Instrumentation
Chapter 1, “Writing Programs” provides information on addressing the instrument, debugging programs, and other important tasks. Each programming
command is documented in Chapter 3, “Language Reference”. Chapter 4,
“Graphics Language Reference” documents graphics commands for drawing
objects on the display. Refer to Chapter 2, “Examples” for a list of practical
examples using common measurement tasks.
shows you how to program the instru-
IEEE 488.2 Standard Digi-
.
iii
The HP 8702D—At a Glance
iv
The HP 8702D—At a Glance iii
1 Writing Programs
General Information 1-4
Selecting the HP-IB Device Mode 1-9
Making Measurements 1-11
Reading Data 1-14
Data-Processing Chain 1-21
Controlling Command Execution 1-25
Calibrating for Measurements 1-27
Debugging Programs 1-30
Understanding File Names 1-31
Drawing Graphics on the Display 1-33
Monitoring the Instrument 1-34
Response to IEEE-488 Universal Commands 1-40
Contents
2 Examples
Preparing Measurement Settings 2-4
Verifying Measurement Settings 2-6
S11 1-Port Measurement Calibration 2-8
Full 2-Port Measurement Calibration 2-13
Data Transfer Using Markers 2-18
Data Transfer Using ASCII Format 2-22
Data Transfer Using Floating-Point Numbers 2-25
Data Transfer Using Frequency-Array Information 2-28
Data Transfer Using Internal Binary Format 2-32
Using Error Queue 2-34
Generating Interrupts 2-37
Power Meter Calibration 2-41
Using the Learn String 2-45
Reading Calibration Data 2-48
Using Instrument States 2-52
Setting a List Frequency Sweep 2-56
Selecting a Single Segment 2-61
Setting up Limit Lines 2-65
Performing Pass/Fail Tests 2-69
Operation Using Talker/Listener Mode 2-73
Contents-1
Contents
Controlling Peripherals 2-76
Printing Via the Serial Port 2-80
Plotting Data 2-83
Reading Plot Files from Disk 2-86
Reading ASCII Instrument Files 2-94
3 Language Reference
4 Graphics Language Reference
5 Tables and Charts
HP-IB Requirements 5-3
Programming Commands by Functional Group 5-8
Key Definitions 5-26
Contents-2
1
Writing Programs
Writing Programs
Writing Programs
Writing Programs
This chapter provides a general introduction to programming the HP 8702D. It
covers topics such as command syntax, addressing the instrument, initializing
the instrument, and returning measurement results to the computer.
Before you begin programming, you should first become proficient at making
manual measurements as explained in the
learn the techniques and softkey presses needed to make a measurement, you
can refer to Table 5-4, “Keys versus Programming Commands,” on page 5-26
to locate the equivalent programming command.
NOTE:
HP 8702D User’s Guide
. Once you
The HP 8702D conforms to IEEE 488.1 and IEC-625 standards for interfacing instruments.
1-2
What you’ll find in this chapter
General Information1-4
To select the communication mode 1-8
To change the HP-IB address1-8
Selecting the HP-IB Device Mode1-9
To change the HP-IB device mode 1-10
Making Measurements1-11
Reading Data1-14
Data-Processing Chain 1-21
Controlling Command Execution 1-25
Calibrating for Measurements 1-27
To calibrate the instrument1-27
Debugging Programs 1-30
To start debugging mode 1-30
Understanding File Names1-31
Drawing Graphics on the Display1-33
Monitoring the Instrument1-34
Response to IEEE-488 Universal Commands 1-40
Writing Programs
Writing Programs
1-3
Writing Programs
General Information
General Information
The HP 8702D occupies two HP-IB addresses: the instrument itself and the
display. The display address is derived from the instrument address as
described in “Drawing Graphics on the Display” on page 1-33. These addresses
are stored in short-term, non-volatile memory and are not affected when you
PRESET
press
device 16, and the display address is device 17.
There is also an address for the system controller. This address refers to the
controller when the HP 8702D is being used in pass-control mode. This is the
address that control is passed back to when the HP 8702D-controlled operation is complete.
You can change the HP-IB address from the front panel as described in “To
change the HP-IB address” on page 1-8.
or cycle the power. The default address for the HP 8702D is
HP-IB status lights
When the HP 8702D is connected to the HP-IB, the front-panel HP-IB status
lights indicate the current status of the HP 8702D. These lights have the following definitions:
R = Remote operation
L = Listen mode
T = Talk mode
S = Service request (SRQ) asserted by the HP 8702D
Remote mode and front-panel lockout
Whenever the instrument is controlled by a computer, the front-panel HP-IB
remote status light, R, is turned on, and the instrument keys are disabled.
Press the
Consult the documentation for your programming environment to determine
which commands are used to put an instrument in the remote and local lockout modes. These are not HP 8702D commands; they control HP-IB control
lines and do not send any characters to the HP 8702D.
1-4
LOCAL
key to restore front panel control of the instrument.
Writing Programs
General Information
Initialize the instrument at the start of every program
It is good practice to initialize the instrument at the start of every program.
This ensures that the bus and all appropriate interfaces are in a known state.
HP BASIC provides a CLEAR command which clears the interface buffer and
also resets the instrument’s parser. (The parser is the program that reads the
instructions that you send.) Whenever the instrument is under remote programming control, it should be in the single measurement acquisition mode.
This is automatically accomplished when the RST is used. The RST command
initializes the instrument to the factory preset state:
CLEAR 716
OUTPUT 716;”RST”
Notice in the example above, that the commands are sent to an instrument
address of 716. This indicates address 16 on an interface with select code 7.
Pressing the
SET
key resets the instrument to either the factory preset state or a user-
PRESET
key does not change the HP-IB address. Pressing the
PRE-
defined preset state.
Rules for writing commands
The HP 8702D accepts letters, changing lowercase to uppercase, numbers,
decimal points, +, –, semicolons, carriage returns and line feeds. Leading
zeros, spaces, carriage returns, and unnecessary terminators are ignored,
except when inserted between a command and a numerical or string argument. If the analyzer does not recognize a character as appropriate, it generates a syntax error message and recovers at the next terminator.
For example, the CHAN command must be entered as CHAN1 or CHAN2.
Inserting a space in the syntax (CHAN 1) results in an error. However, a space
must be entered between the MARK2 command and its argument. For example, MARK2 1.4GHZ.
Units and terminators
The HP 8702D outputs data in basic units and assumes these basic units when
it receives an input (unless the input is otherwise qualified). The basic units
and allowable expressions can be found below. Both uppercase and lowercase
letters are acceptable.
1-5
Writing Programs
General Information
Table 1-1. Terminator Codes
SSecondsHZHertz
MSMillisecondsKHZKilohertz
USMicrosecondsMHZMegahertz
NSNanosecondsGHZGigahertz
PSPicosecondsDBdB or dBm
FSFemtosecondsVVolts
Terminators are used to indicate the end of a command. This allows the
HP 8702D to recover to the next command in the event of a syntax error. The
semicolon (;) is the recommended command terminator. The line-feed character (LF) and the HP-IB EOI line can also be used as terminators. Again, the
HP 8702D will ignore the carriage-return character (CR).
1-6
General Information
.
Table 1-2. HP-IB Interface Capabilities
CapabilityDescription
SH1Full-source handshake.
AH1 Full-acceptor handshake.
T6 Basic talker, answers serial poll, unaddresses if MLA is issued. No talk-only mode.
L4 Basic listener, unaddresses if MTA is issued. No listen-only mode.
SR1 Complete service request (SRQ) capabilities.
RL1 Complete remote/local capability including local lockout.
PP0 Does not respond to parallel poll.
DC1 Complete device clear.
DT1 Responds to a Group Execute Trigger (GET) in the hold-trigger mode.
Writing Programs
C1,C2,C3 System controller capabilities in system-controller mode.
C10 Pass control capabilities in pass-control mode.
E2 Tri-state drivers.
LE0 No extended listener capabilities.
TE0 No extended talker capabilities.
1-7
Writing Programs
General Information
To select the communication mode
1
Press the
2
Press
LOCAL
key.
TALKER/LISTENER
so that this softkey is underlined.
To change the HP-IB address
1
Press the
2
Press
3
Press
4
Use the front-panel knob or keys to enter the new HP-IB address.
LOCAL
key.
SET ADDRESSES.
ADDRESS: 8702
.
1-8
Writing Programs
Selecting the HP-IB Device Mode
Selecting the HP-IB Device Mode
Three different device modes are possible for the HP 8702D:
• talker/listener mode
• system-controller mode
• pass-control mode
Performing an instrument preset does not affect the selected bus mode,
although the bus mode will return to talker/listener mode if the line power is
cycled.
Tal k er /li st e ne r mo d e
This is the mode that is normally used for remote programming of the
HP 8702D. In talker/listener mode, the HP 8702D and all peripheral devices
are controlled from an external instrument controller. The controller can command the HP 8702D to talk and other devices to listen. The HP 8702D and
peripheral devices cannot talk directly to each other unless the computer sets
up a data path between them. This mode allows the HP 8702D to act as either
a talker or a listener, as required by the controlling computer for the particular
operation in progress.
While in this mode, the HP 8702D can make a plot or print using the
PLOT;
addressed to talk by the system controller and then dump the display to a
plotter/printer that the system controller has addressed to listen. Use of the
commands
controller.
OUTPPRIN;
or
PLOT;
commands. The HP 8702D will wait until it is
PRINALL;
and
require control to be passed to another
OUTP-
System-controller mode
Do not attempt to use this mode for programming. This mode allows the
HP 8702D to control peripherals directly in a stand-alone environment (without an external controller). This mode can only be selected manually from the
HP 8702D’s front panel. It can only be used if no active computer or instrument controller is connected to the system via HP-IB. If an attempt is made to
set the HP 8702D to the system-controller mode when another controller is
1-9
Writing Programs
Selecting the HP-IB Device Mode
connected to the interface, the following message is displayed on the
HP 8702D’s display screen:
ON HP-IB"
The HP 8702D must be set to the system-controller mode in order to access
peripherals from the front panel. In this mode, the HP 8702D can directly control peripherals (for example, plotters, printers, disk drives, and power
meters) and the HP 8702D may plot, print, store on disk or perform power
meter functions.
Pass-control mode
This mode allows the computer to control the HP 8702D via HP-IB (as with
the talker/listener mode), but also allows the HP 8702D to take control of the
interface in order to plot, print, or access a disk. During an HP 8702D-controlled peripheral operation, the host computer is free to perform other internal tasks (for example, data or display manipulation) while the HP 8702D is
controlling the bus. After the HP 8702D-controlled task is completed, the
HP 8702D returns control to the system controller.
In pass-control mode, the HP 8702D can request control from the system controller and take control of the bus if the controller addresses it to take control.
This allows the HP 8702D to take control of printers, plotters, and disk drives
on an as-needed basis. The HP 8702D sets event-status-register bit 1 when it
needs control of the interface, and the HP 8702D will transfer control back to
the system controller at the completion of the operation. It will pass control
back to its controller address, specified by ADDRCONT.
.
"CAUTION: ANOTHER SYSTEM CONTROLLER
To change the HP-IB device mode
1
Press the
2
Press
1-10
LOCAL
key.
SET ADDRESSES.
Writing Programs
Making Measurements
Making Measurements
This section explains how to organize instrument commands into a measurement sequence. A typical measurement sequence consists of the following
steps:
1
Setting up the instrument
2
Calibrating the test setup
3
Connecting the device under test
4
Taking the measurement data
5
Post-processing the measurement data
6
Transferring the measurement data
Step 1. Setting up the instrument
Define the measurement by setting all of the basic measurement parameters.
These include:
• sweep type
• frequency span
• sweep time
• number of points (in the data trace)
• RF power level
• type of measurement
• IF averaging
• IF bandwidth
You can quickly set up an entire instrument state, using the save/recall registers and the learn string. The learn string is a summary of the instrument state
compacted into a string that the computer reads and retransmits to the analyzer. Refer to “Using the Learn String” on page 2-45.
1-11
Writing Programs
Making Measurements
Step 2. Calibrating the test setup
After you have defined an instrument state, you should perform a measurement calibration. Although it is not required for the measurement of O/E and
E/O devices, a measurement calibration is required to obtain useful measurements.
The following list describes several methods to calibrate the analyzer:
• Stop the program and perform a calibration from the analyzer’s front panel.
• Use the computer to guide you through the calibration, as discussed in “S11 1Port Measurement Calibration” on page 2-8 and “Full 2-Port Measurement Calibration” on page 2-13.
• Transfer the calibration data from a previous calibration back into the analyzer,
as discussed in “Using Instrument States” on page 2-52.
Step 3. Connecting the device under test
After you connect your test device, you can use the computer to speed up any
necessary device adjustments such as limit testing, bandwidth searches, and
trace statistics.
Step 4. Taking the measurement data
Measure the device response and set the analyzer to hold the data. This captures the data on the analyzer display.
By using the single-sweep command (SING), you can insure a valid sweep.
When you use this command, the analyzer completes all stimulus changes
before starting the sweep, and does not release the HP-IB hold state until it
has displayed the formatted trace. Then when the analyzer completes the
sweep, the instrument is put into hold mode, freezing the data. Because single
sweep is OPC-compatible, it is easy to determine when the sweep has been
completed.
The number-of-groups command (NUMGn) triggers multiple sweeps. It is
designed to work the same as the single-sweep command. NUMGn is useful for
making a measurement with an averaging factor n (n can be 1 to 999). Both
the single-sweep and number-of-groups commands restart averaging.
1-12
Writing Programs
Making Measurements
Step 5. Post-processing the measurement data
Figure 1-1 on page 1-22 shows the process functions used to affect the data
after you have made an error-corrected measurement. These process functions have parameters that can be adjusted to manipulate the error-corrected
data prior to formatting. They do not affect the analyzer’s data gathering. The
most useful functions are trace statistics, marker searches, electrical-delay
offset, time domain, and gating.
After performing and activating a full 2-port measurement calibration, any of
the four S-parameters may be viewed without taking a new sweep.
Step 6. Transferring the measurement data
Read your measurement results. All the data-output commands are designed
toensure that the data transmitted reflects the current state of the instrument.
1-13
Writing Programs
Reading Data
Reading Data
Output queue
Whenever a output-data command is received, the HP 8702D puts the data
into the output queue (or buffer) where it is held until the system controller
outputs the next read command. The queue, however, is only one event long;
the next output-data command will overwrite the data already in the queue.
Therefore, it is important to read the output queue immediately after every
interrogation or data request from the HP 8702D.
Command interrogate
All instrument functions can be interrogated to find the current ON/OFF state
or value. For instrument state commands, append the question mark character (?) to the command to interrogate the state of the functions. Suppose the
operator has changed the power level from the HP 8702D’s front panel. The
computer can ascertain the new power level using the HP 8702D’s commandinterrogate function. If a question mark is appended to the root of a command,
the HP 8702D will output the value of that function. For instance,
POWE 7 DB;
RF source power at the test port. When the HP 8702D receives
prepares to transmit the current RF source power level. This condition illuminates the HP 8702D front-panel talk light (T). In this case, the HP 8702D
transmits the output power level to the controller.
ON/OFF commands can be also be interrogated. The reply is a one (1) if the
function is ON or a zero (0) if it is OFF. For example, if a command controls an
active function that is underlined on the HP 8702D display, interrogating that
command yields a one (1) if the command is underlined or a zero (0) if it is
not. As another example, there are nine options on the format menu and only
one option is underlined at a time. Only the underlined option will return a
one (1) when interrogated. For instance, send the command string
the HP 8702D. If dual-channel display is switched ON, the HP 8702D will
return a one (1) to the instrument controller.
sets the source power to 7 dB, and
POWE?;
outputs the current
POWE?;
, it
DUAC?;
to
1-14
Writing Programs
Reading Data
Similarly, to determine if phase is being measured and displayed, send the
command string
PHAS?;
to the HP 8702D. In this case, the HP 8702D will
return a one (1) if phase is currently being displayed. Since the command only
applies to the active channel, the response to the
PHAS?;
query depends on
which channel is active.
Output syntax
The following three types of data are transmitted by the HP 8702D in ASCII
format:
• response to interrogation
• certain output commands
• ASCII floating-point (form 4) array transfers
Marker-output commands and interrogated commands are output in ASCII
format only, meaning that each character and each digit is transmitted as a
separate byte, leaving the receiving computer to reconstruct the numbers and
strings. Numbers are transmitted as 24-character strings, consisting of:
-DDD.DDDDDDDDDDDDDDDE-DD
When multiple numbers are sent, the numbers are separated by commas.
Table 1-3. Form 4 (ASCII) Data-Transfer Character Definitions
Character(s)*Definition
Sign– for negative, blank for positive.
3 digitsDigits to the left of the decimal point.
Decimal point
15 digitsDigits to the right of the decimal point.
EExponent notation.
Sign– for negative, + (or blank) for positive.
ExponentTwo digits for the exponent.
* The items in this column are separated by commas and delimited (terminated) with a line feed
character (LF).
1-15
Writing Programs
Reading Data
Marker data
The HP 8702D offers several options for outputting trace-related data. Trace
information can be read out of the HP 8702D in several different formats. Data
can be selectively read from the trace using the markers, or the entire trace
can be read by the controller. If only specific information is required (such as a
single point on the trace or the result of a marker search), the marker output
command can be used to read the information.
To read the trace data using the marker, the marker must first be assigned to
the desired frequency. This is accomplished using the marker commands. The
controller sends a marker command followed by a frequency within the tracedata range. If the actual desired frequency was not sampled, the markers can
be set to continuous mode and the desired marker value will be linearly interpolated from the two nearest points. This interpolation can be prevented by
putting the markers into discrete mode. Discrete mode allows the marker to
only be positioned on a measured trace-data point.
As an alternative, the HP 8702D can be programmed to choose the stimulus
value by using the
or bandwidths search can be automatically determined with
MARKER SEARCH
function. Maximum, minimum, target value,
MARKER SEARCH
To continually update the search, switch the marker tracking ON. The tracemaximum search will remain activated until:
• The search is switched OFF
• The tracking is switched OFF
• All markers are switched OFF
.
Marker data can be output to a controller with a command to the HP 8702D.
This set of commands causes the HP 8702D to transmit three numbers:
marker value 1, marker value 2, and marker stimulus value. In log-magnitude
display mode we get the log magnitude at marker 1, zero, and the marker frequency. Refer to “Units as a Function of Display Format” on page 1-17 for a
complete listing of all the possibilities for values 1 and 2. The three possibilities for the third parameter are:
•frequency
• time (as in time domain)
• CW time
1-16
Table 1-4. Units as a Function of Display Format
OUTPMARKOUTPFORMMarker Readout
Display FormatMarker Mode
Value 1Value 2Value 1Value 2Value
Writing Programs
Reading Data
AUX
Value
LOG MAGdB†dB†dB
PHASE degrees†degrees†
DELAY seconds†seconds†
SMITH CHARTLIN MKRlin magdegreesrealimaglin mag degrees
LOG MKRdBdegreesrealimagdBdegrees
Re/Imrealimagrealimagrealimag
R + jXreal ohmsimag ohmsrealimagreal ohmsimag ohms
G + jBreal
Siemens
POLARLIN MKRlin magdegreesrealimaglin magdegrees
LOG MKRdBdegreesrealimagdBdegrees
Re/Imrealimagrealimagrealimag
LIN MAGlin mag†lin mag† lin mag†
REAL real†real†real
SWR SWR†SWR†SWR
* The marker readout values are the marker values displayed in the upper right-hand corner of the display. They also correspond to
the value and auxiliary value associated with the fixed marker.
†
Value 2 is not significant in this format, though it is included in data transfers.
imag
Siemens
realimagreal
degrees†
seconds†
Siemens
†
imag
Siemens
†
†
1-17
Writing Programs
Reading Data
Array-data formats
The HP 8702D can transmit and receive arrays in the HP 8702D’s internal
binary format, as well as four different numeric formats. The current format is
set with the FORM command. This command does not affect learn-string
transfers, calibration-kit string transfers, or non-array transfers, such as command interrogate, or output marker values. A transmitted array will be output
in the current format, and the HP 8702D will attempt to read incoming arrays
according to the current format. Each data point in an array is a pair of numbers, usually a real/imaginary pair. The number of data points in each array is
the same as the number of points in the current sweep.
The five formats are described below:
1
The HP 8702D’s internal binary format, 6 bytes-per-data point. The array is
preceded by a four-byte header. The first two bytes represent the string
the standard block header. The second two bytes are an integer representing
the number of bytes in the block to follow. FORM 1 is best applied when rapid
data transfers, not to be modified by the computer nor interpreted by the user,
are required.
2
IEEE 32-bit floating-point format, 8 bytes-per-data point. The data is preceded
by the same header as in FORM 1. Each number consists of a 1-bit sign, an 8bit biased exponent, and a 23-bit mantissa. FORM 2 is the format of choice if
your computer supports single-precision floating-point numbers.
"#A"
,
3
IEEE 64-bit floating-point format, 16 bytes-per-data point. The data is
preceded by the same header as in FORM 1. Each number consists of a 1-bit
sign, an 11-bit biased exponent, and a 52-bit mantissa. This format may be used
with double-precision floating-point numbers. No additional precision is
available in the HP 8702D data, but FORM 3 may be a convenient form for
transferring data to your computer.
4
ASCII floating-point format. The data is transmitted as ASCII numbers, as
described in “Output syntax” on page 1-15. There is no header. The HP 8702D
uses FORM 4 to transfer data that is not related to array transfers (for example,
marker responses and instrument settings).
5
PC-DOS 32-bit floating-point format with 4 bytes-per-number, 8 bytes-per-data
point. The data is preceded by the same header as in FORM 1. The byte order
is reversed to comply with PC-DOS formats.
controller, FORM 5 is the most effective format to use.
If you are using a PC-based
The HP 8702D terminates each transmission by asserting the EOI interface
line with the last byte transmitted. Table 1-5 on page 1-19 offers a comparative
overview of the five array-data formats.
1-18
Table 1-5. HP 8702D/Option 011 Array-Data Formats
Writing Programs
Reading Data
Format TypeType of Data
1Internal Binary3612061210
2IEEE 32-bit
Floating-Point
3IEEE 64-bit
Floating-Point
4ASCII Numbers245010,05010,050
5PC-DOS 32-bit
Floating-Point
a. There are two data values (real and imaginary) for every data point.
b. No header is used in form 4.
Bytes per Data
Value
4816081612
81632163220
4816081612
Bytes per Data
Point
a
Bytes per 201
Point Trace
Trace-data transfers
Transferring trace data from the HP 8702D using an instrument controller can
be divided into three steps:
1
allocating an array to receive and store the data
2
commanding the HP 8702D to transmit the data
3
accepting the transferred data
Total Bytes
with Header
b
Data residing in the HP 8702D is always stored in pairs for each data point (to
accommodate real/imaginary pairs). The real value is first, followed by the
imaginary value. Hence, the receiving array has to be two elements wide, and
as deep as the number of points in the array being transferred. Memory space
for the array must be declared before any data can be transferred from the
HP 8702D to the computer. When reading logarithmic amplitude and phase,
save the first value of each data point pair and discard the second value.
As mentioned earlier, the HP 8702D can transmit data over HP-IB in five different formats. The type of format affects what kind of data array is declared
(real or integer), because the format determines what type of data is transferred. “Data Transfer Using Markers” on page 2-18 illustrates an ASCII transfer using Form 4. For more information on the various data formats, refer to
“Array-data formats” on page 1-18. For information on the various types of
data that can be obtained (raw data, error-corrected data, etc.), refer to “Data
levels” on page 1-23.
1-19
Writing Programs
Reading Data
Frequency-related arrays
Frequency-related values are calculated for the HP 8702D displays. The only
data available to the programmer are the start and stop frequencies, or center
and span frequencies, of the selected frequency range.
In a linear frequency range, the frequency values can be easily calculated
because the trace data points are equally spaced across the trace. Relating the
data from a linear frequency sweep to frequency can be done by interrogating
the start frequency, the frequency span, and the number of points in the trace.
Given that information, the frequency of point n in a linear-frequency sweep is
represented by the equation:
F=Start frequency + (n–1) × Span/(Points–1)
In most cases, this is an easy solution for determining the related frequency
value that corresponds with a data point. This technique is illustrated in “Data
Transfer Using Markers” on page 2-18.
When using log sweep or a list-frequency sweep, the points are not evenly
spaced over the frequency range of the sweep. In these cases, the frequencies
can be read directly out of the instrument with the
OUTPLIML
command.
“Data Transfer Using Frequency-Array Information” on page 2-28 demonstrates this technique.
Executing
OUTPLIML;
reports the limit-test results by transmitting:
• the stimulus point tested
• a number indicating the limit-test results
• the upper test limit at the stimulus point (if available)
• the lower test limit at the stimulus point (if available)
The numbers used to indicate the limit-test results are:
• a negative one (–1) for no test
• a zero (0) for fail
• a positive one (1) for pass
If there are no limits available, the HP 8702D transmits zeros.
This data is very useful when testing with limit lines. It provides a method of
obtaining accurate frequency-stimulus values to correspond with the trace
data. The other limit-related values may be discarded and the stimulus values
used with the trace-data points.
1-20
Writing Programs
Data-Processing Chain
Data-Processing Chain
This section describes the manner in which the HP 8702D processes measurement data. It includes information on data arrays, common output commands,
data levels, the learn string, and the calibration kit string.
Data arrays
Figure 1-1 on page 1-22 shows the different kinds of data available within the
instrument:
• raw measured data
• error-corrected data
• formatted data
• trace memory
• calibration coefficients
Trace memory can be directly output to a controller with
cannot be directly transmitted back.
OUTPMEMO;
, but it
1-21
Writing Programs
Data-Processing Chain
Figure 1-1. The data-processing chain
All the data-output commands are designed to insure that the data transmitted reflects the current state of the instrument:
OUTPDATA, OUTPRAW
•
, and
OUTPFORM
will not transmit data until all format-
ting functions have completed.
OUTPLIML, OUTPLIMM
•
, and
OUTPLIMF
will not transmit data until the limit
test has occurred (if activated).
OUTPMARK
•
will activate a marker if a marker is not already selected. It will also
insure that any current marker searches have been completed before transmitting data.
OUTPMSTA
•
insures that the statistics have been calculated for the current trace
before transmitting data. If the statistics are not activated, it will activate the
statistics long enough to update the current values before deactivating the statistics.
1-22
Writing Programs
Data-Processing Chain
OUTPMWID
•
insures that a bandwidth search has been executed for the current
trace before transmitting data. If the bandwidth-search function is not activated, it will activate the bandwidth-search function long enough to update the
current values before switching OFF the bandwidth-search functions.
Data levels
Different levels of data can be read out of the instrument. Refer to the dataprocessing chain in Figure 1-1 on page 1-22.
The following list describes the different types of data that are available from
the HP 8702D.
Raw data
Error-corrected
data
Formatted data
The basic measurement data, reflecting the stimulus parameters, IF averaging, and IF bandwidth. If a full 2-port measurement calibration is activated,
there are actually four raw arrays kept: one for each raw S-parameter. The
data can be output to a controller with the commands
OUTPRAW3, OUTPRAW4
. Normally, only raw 1 is available, and it holds the cur-
OUTPRAW1, OUTPRAW2
rent parameter. If a 2-port measurement calibration is active, the four arrays
refer to S
, S21, S12, and S22 respectively. This data is represented in real/
11
imaginary pairs.
This is the raw data with error-correction applied. The array represents the
currently measured parameter, and is stored in real/imaginary pairs. The
error-corrected data can be output to a controller with the
mand. The
OUTPMEMO;
command reads the trace memory, if available. The
OUTPDATA;
com-
trace memory also contains error-corrected data. Note that neither raw nor
error-corrected data reflect such post-processing functions as electrical-delay
offset, trace math, or time-domain gating.
This is the array of data actually being displayed. It reflects all post-processing
functions such as electrical delay and time domain. The units of the array output depend on the current display format. Refer to Table 1-4, “Units as a Function of Display Format,” on page 1-17 for the various units defined as a
function of display format.
,
1-23
Writing Programs
Data-Processing Chain
Calibration
coefficients
The results of a measurement calibration are arrays containing calibration
coefficients. These calibration coefficients are then used in the error-correction routines. Each array corresponds to a specific error term in the error
model. The
HP 8702D User’s Guide
details which error coefficients are used
for specific calibration types, as well as the arrays those coefficients can be
found in. Not all calibration types use all 12 arrays. The data is stored as real/
imaginary pairs.
Generally, formatted data is the most useful of the four data levels, because it
is the same information the operator sees on the display. However, if post-processing is unnecessary (possibly in cases involving smoothing), error-corrected data may be more desirable. Error-corrected data also affords the user
the opportunity to input the data to the HP 8702D and apply post-processing
at another time.
Learn string and calibration-kit string
The learn string is a summary of the instrument state. It includes all the frontpanel settings, the limit-test tables, and the list-frequency table for the current instrument state. It does not include calibration data or the information
stored in the save/recall registers.
The learn string can be output to a controller with the
OUTPLEAS;
executable, which commands the HP 8702D to start transmitting the binary string.
The string has a fixed length for a given firmware revision. It can not be more
than 3000 bytes in length. The array has the same header as in Form 1.
The calibration kit is a set of key characteristics of the calibration standards
used to increase the calibration accuracy. There are default kits for several different connector types. There is also space for a user-defined calibration kit.
The command
OUTPCALK
outputs the currently active calibration kit as a
binary string in Form 1. As with the learn string, the calibration-kit string has a
fixed length for a given firmware revision. It can not be longer than
1000 bytes.
1-24
Writing Programs
Controlling Command Execution
Controlling Command Execution
Some HP 8702D commands require relatively longer execution times due to
measurement sweeps or other processes and, occasionally, there is a need to
know when certain HP 8702D operations have been completed. There is an
operation-complete function (OPC) that allows a synchronization of programs
with the execution of certain key commands. Table 1-6 on page 1-26 lists all
the OPC-compatible commands for the instrument.
Synchronized program execution with OPC command
Issue an
byte or ESR operation-complete bit will then be set after the execution of the
OPC-compatible command. For example, issuing
bit to be set when the single sweep is finished. Issuing
OPC;
is complete.
Addressing the HP 8702D to talk after issuing
addressed to talk without selecting output
HP 8702D will halt the computer by not transmitting the one (1) until the
command has completed. For example, executing
immediately interrogating the HP 8702D, causes the bus to halt until the
instrument preset is complete and the HP 8702D outputs a one (1).
As another example, consider the timing of sweep completion. Send the command string
HP 8702D sweep time to 3 seconds, and then waits for completion of a single
sweep to respond with a one (1). The computer is programmed to read the
one (1) response from the HP 8702D as the completion of the single sweep.
The program then waits until the sweep is completed before continuing operation. At this point a valid trace exists and the trace data can be read into the
computer.
OPC;
, causes the HP 8702D to output a one (1) when the command execution
OPC?;
or
SWET 3 S;OPC?;SING;
prior to an OPC-compatible command. The status
OPC;SING;
OPC?;
to the HP 8702D. This string sets the
will not cause an
OPC?;PRES;
causes the OPC
OPC?;
, in place of
error, but the
, and then
1-25
Writing Programs
Controlling Command Execution
OPC-compatible commands delay execution of other commands
The HP 8702D cannot process other commands while executing OPC-compatible commands. Once a OPC-compatible command is received, the HP 8702D
reads new commands into the input buffer, but it will not begin the execution
of any commands until the completion of the OPC-compatible command.
When the 15-character input buffer is full, the HP 8702D holds off the bus
until it is able to process the commands in the buffer.
Table 1-6. OPC-Compatible Commands
CHANHARMREFD
a
CLASS
CLEARALLISOD
DATI MANTRIGRST
DONENOOPSAV
EDITDONENUMGSAVC
EXTTOFFPRESSAVE
EXTTONRAID SAVEREG
EXTTPOIN
FREQOFF
a
FWDI
a
FWDM
INSMRESPDONE
a
REV
RAIRESP
RAIISOL
a
a
SING
STAN
RECATRAD
RECAREGWAIT
a. The CLASS commands are OPC-compatible if there is only one standard in the class.
1-26
Writing Programs
Calibrating for Measurements
Calibrating for Measurements
Measurement calibration over HP-IB follows the same command sequence as a
calibration from the front panel. Since different cal kits can have a different
number of standards in a given class, any automated calibration sequence is
valid only for a specific cal kit. Table 1-7 on page 1-28 indicates the relation-
ship between calibration and classes. Table 1-8 on page 1-29 describes the cal-
ibration arrays.
To calibrate the instrument
1
Select a calibration kit, such as 50 ohm type N (
a calibration standard definition from disk or enter the coefficients for O/E and
E/O measurements.
2
Select a calibration type, such as S
3
Call each class used by the calibration type, such as
CLASS11A
(
transmission, and isolation subsequences must be opened before the classes in
the subsequence are called, and then closed at the end of each subsequence.
4
If a class has more than one standard in it, select a standard from the menu
presented (
STANA
The
a sweep. If a class has only one standard in it, which means that it will trigger a
sweep when called, the class command will be held also.
5
If, during a calibration, two standards are measured to satisfy one class, the
class must be closed with
6
Declare the calibration done, such as with
HP-IB).
over HP-IB). During a 2-port calibration, the reflection,
STANA
STANG
to
STANG
to
commands are all held commands because they trigger
over HP-IB).
DONE;
11
.
1-port (
CALKN50;
CALIS111;
DONE 1-PORT CAL (SAV1;
over HP-IB). Load
over HP-IB).
FORWARD: OPEN
over
1-27
Writing Programs
Calibrating for Measurements
Table 1-7. Relationship Between Calibration and Classes
ClassResponse
Response
and
Isolation
S11
1-port
S22
1-port
One path
2-port
Full 2-port TRL*/LRM*
Response
and Match
E/O
and Match
Reflectiona:•• •
S11A, RE FW MTCH••• • ••
S11B, LN FW MTCH••• • ••
S11C, LN FW TRAN•• • • ••
S22A, LN RV MTCH•• • •
S22B, LN RV TRAN•• • •
S22C, LN RV TRAN•• • •
Transmission:•• •
Forward match•• • •
Forward trans• • • ••
Reverse match• •
Reverse trans• •
a.
Isolation:
Forward •• • ••
Reverse • •
•• •
Response
O/E
Response •
Response and isolation:
Response •
Isolation •
a. These subheadings must be called when doing 2-port calibrations.
1-28
Writing Programs
Calibrating for Measurements
Table 1-8. Calibration Arraysa
ArrayResponse
1ER or ETE
2E
3 E
4E
5E
6E
7E
8E
9E
10E
11E
12E
a. Meaning of first subscript: D=directivity , S=source match , R=reflection tracking, X=crosstalk, L=load match , T=transmissio n tracking.
b. Meaning of second subscript: F=forward, R=reverse.
c. One path, 2-port cal duplicates arrays 1 to 6 in arrays 7 to 12.
d. Response and isolation corrects for crosstalk and transmission tracking in transmission measurements, and for directivity and reflection
tracking in reflection measurements.
b
Response and
Isolation
(ED)
X
(ER)ESFE
T
d
Response and
Match E/O
E
DF
RF
XF
TF
Response and
Match O/E
E
DR
SR
E
RR
E
XF
E
LF
TF
1-port 2-port
E
D
E
S
E
R
E
DF
E
SF
E
RF
E
XF
E
LF
E
TF
DR
SR
RR
XR
LR
TR
c
TRL*/LRM*
EDF
ESF
ERF
E
XF
ELF
ETF
E
DR
ESR
ERR
EXR
ELR
ETR
1-29
Writing Programs
Debugging Programs
Debugging Programs
An HP-IB diagnostic feature (debug mode) is available in the HP-IB menu.
Activating the debug mode causes the analyzer to scroll incoming HP-IB commands across the display. Nonprintable characters are represented with an
π
character. Any time the analyzer receives a syntax error, the commands halt,
and a pointer indicates the misunderstood character.
To start debugging mode
1
Press the
2
Press
LOCAL
key.
HP-IB DIAG ON OFF
so that ON its highlighted.
1-30
Writing Programs
Understanding File Names
Understanding File Names
Disk files created by the analyzer consist of a state name of up to eight characters, such as FILTER, appended with up to two characters. In LIF format, the
file name is FILTERXX. In DOS format, the filename is FILTER.XX. The first
appended character is the file type, telling the kind of information in the file.
The second appended character is a data index, used to distinguish files of the
same type. Data and calibration files are Form 3 data (without a header)
which can be read off the disk. The other files are not meant to be decoded.
Table 1-9 on page 1-32 lists the appended characters and their meanings.
1-31
Writing Programs
Understanding File Names
Table 1-9. Disk File Names
Appended
Character 1
IInstrument state
GGraphics1Display graphics
DError corrected data1Channel 1
RRaw data1 to 4Channel 1, raw arrays 1 to 4
FFormatted data1Channel 1
MMemory trace1Channel 1
PInstrument state appendix
CCal kitK
1 Cal data, channel 10Stimulus state
Definition
Appended
Character 2
0Graphics index
2Channel 2
5 to 8Channel 2, raw arrays 1 to 4
2Channel 2
2Channel 2
1 to 9Coefficients 1 to 9
ACoefficient 10
Definition
BCoefficient 11
CCoefficient 12
2Cal data, channel 20 to CSame as channel 1
1-32
Writing Programs
Drawing Graphics on the Display
Drawing Graphics on the Display
You can use the HP 8702D’s screen as a graphics display for showing connection diagrams or custom instructions to an operator. For programming purposes, consider the display as a separate device; it has its own HP-IB address.
The display’s address is configured automatically based on the address of the
HP 8702D.
The display’s default HP-IB address is 17. If you change the HP 8702D’s
default address, you can determine the display’s new address with the following instructions. If the HP 8702D address is an even number, add 1 to the
address. If the HP 8702D address is an odd number, subtract 1 from the
address.
The display accepts a subset of Hewlett-Packard Graphics Language (HP-GL)
commands. These commands are documented in Chapter 4, “Graphics Language Reference”. Some HP-GL commands are accepted but ignored. These
commands are documented in Table 1-10 on page 1-34.
When using the graphics commands, you will need to specify positions on the
display. The origin (0, 0) is located in the display’s lower left corner.
Graticule:
• length: 350 to 4915
• height: 150 to 3950
Complete Display (includes annotation and softkeys):
• length: 0 to 5850
• height: 0 to 4095
1-33
Writing Programs
Monitoring the Instrument
Table 1-10. Ignored but Accepted HP-GL Commands
CommandDescription
IMInput service request mask
IPInput P1,P2 scaling points
IWInput window
OCOutput current pen position
OEOutput error
OIOutput identity
OSOutput status
SLCharacter slant
SRRelative character size
Monitoring the Instrument
Almost every program that you write will need to monitor the HP 8702D for its
operating status and errors. This includes querying execution or command
errors and determining whether or not measurements have been completed.
Several status registers and queues are provided to accomplish these tasks. In
this section, you’ll learn how to enable and read these registers. You’ll also
learn about reading the error messages in the error queue.
1-34
Writing Programs
Monitoring the Instrument
Figure 1-2. Status reporting structure
1-35
Writing Programs
Monitoring the Instrument
The Status Byte
The analyzer has a status-reporting mechanism that reports information about
specific analyzer functions and events. The status byte (consisting of summary bits) is the top-level register. Each bit reflects the condition of another
register or queue. If a summary bit is set (equals 1), the corresponding register or queue should be read to obtain the status information and clear the condition. Reading the status byte does not affect the state of the summary bits.
The summary bits always reflect the condition of the summarized queue or
register. The status byte can be read by a serial poll or by using the command
OUTPSTAT
operator during the execution of a test sequence.
. When using this command, the sequencing bit can be set by the
OUTPSTAT
does not automatically put the instrument in remote mode, thus giving the operator access
to the analyzer’s front-panel functions.
The status byte:
• summarizes the error queue
• summarizes two event-status registers that monitor specific conditions inside
the instrument
• contains a bit that is set when the instrument is issuing a service request (SRQ)
over HP-IB
• contains a bit that is set when the analyzer has data to transmit over HP-IB
Any bit in the status byte can generate a service request
Any bit in the status byte can be selectively enabled to generate a service
request (SRQ) when set. Setting a bit in the service-request-enable register
with the
SREnn;
executable enables the corresponding bit in the status byte.
The units variable nn represents the binary equivalent of the bit in the status
byte. For example,
3+24
2
= 24) and disables all the other bits. SRE will not affect the state of the
SRE24;
enables status-byte bits 3 and 4 (since
status-register bits.
The status byte summarizes two queues
The status byte also summarizes two queues: the output queue and the error
queue. (The error queue is described in “Error Messages” on page 1-39.)
When the analyzer outputs information, it puts the information in the output
queue where it resides until the controller reads it. The output queue is only
one event long. Therefore, the next output request will clear the current data.
The summary bit is set whenever there is data in the output queue.
1-36
Writing Programs
Monitoring the Instrument
Table 1-11. Bits in the Status Byte
Bit Definition
0Waiting for reverse GET. A one path, 2-port measurement calibration is active, and the
instrument has stopped, waiting for the operator to connect the device for reverse
measurement.
1Waiting for forward GET. A one path, 2-port measurement calibration is active, and the
instrument has stopped, waiting for the operator to connect the device for forward
measurement.
2Check event-status-register B. One of the enabled bits in event status register B has
been set.
3Check error queue. An error has occurred and the message has been placed in the error
queue, but has not been read yet.
4Message in output queue. A command has prepared information to be output, but it has
not been read yet.
5Check event-status register. One of the enabled bits in the event-status register has been
set.
6Request service. One of the enabled status-byte bits is causing an SRQ.
7Preset. An instrument preset has been executed.
The Event-Status Register and Event-Status-Register B
The event-status register and event-status register B are the other two registers in the status-reporting structure. They are selectively summarized by bits
in the status byte via enable registers. The event-status registers consist of
latched bits. A latched bit is set at the beginning of a specific trigger condition
in the instrument. It can only be cleared by reading the register. The bit will
not be reactivated until the condition occurs again. If a bit in one of these two
registers is enabled, it is summarized by the summary bit in the status byte.
The registers are enabled using the commands
which work in the same manner as
SRE
the binary equivalent of the bit in the status byte.
If a bit in one of the event-status registers is enabled, and therefore, summary
bit in the status byte is enabled, an SRQ will be generated. The SRQ will not be
cleared until one of the five following conditions transpire:
1
The event-status register is read, clearing the latched bit.
ESEnn;
nn
. The units variable nn represents
and
ESNBnn;
, both of
1-37
Writing Programs
Monitoring the Instrument
2
The summary bit in the status byte is disabled.
3
The event-status-register bit is disabled.
4
The status registers are cleared with the
5
An instrument preset is performed.
CLES;
command.
Service requests generated when there are error messages or when the instrument is waiting for the Group Execute Trigger (GET) command are cleared
by:
• reading the errors
• issuing GET (disabling the bits)
• clearing the status registers
Table 1-12. Bits in the Event-Status Register
BitsDefinition
0Operation complete. A command, for which OPC has been enabled, has completed
operation.
1Request control. The analyzer has been commanded to perform an operation that
requires control of a peripheral, and needs control of HP-IB. Requires pass-control mode.
2Query error. The analyzer has been addressed to talk but there is nothing in the output
queue to transmit.
3Sequence bit. A sequence has executed the assert SRQ command.
4Execution error. A command was received that could not be executed.
5Syntax error. The incoming HP-IB commands contained a syntax error. The syntax error
can only be cleared by a device clear or an instrument preset.
6User request. The operator has pressed a front-panel key or turned the RPG.
7Power on. A power-on sequence has occurred since the last read of the register.
1-38
Writing Programs
Monitoring the Instrument
Table 1-13. Bits in the Event-Status Register B
BitDefinition
0Single sweep, number of groups, or calibration step complete. A single sweep, group, or
calibration step has been completed since the last read of the register.
1Service routine waiting or done. An internal service routine has completed operation, or
is waiting for an operator response.
2Data entry complete. A terminator key has been pressed or a value entered over HP-IB
since the last read of the register.
3Limit failed, Channel 2. Limit test failed on Channel 2.
4Limit failed, Channel 1. Limit test failed on Channel 1.
5Search failed, Channel 2. A marker search was executed on Channel 2, but the target
value was not found.
6Search failed, Channel 1. A marker search was executed on Channel 1, but the target
value was not found.
Error Messages
7Copy Complete. A copy has been completed since the last read of the register.
When an error condition is detected in the analyzer, a message is generated,
displayed on the analyzer’s display screen, and placed in the error queue.
Error messages consist of an error number followed by an ASCII string no
more than 50 characters long. The string contains the same message that
appears on the analyzer’s display. The error queue holds up to 20 error messages in the order in which they occur. The error messages remain in the error
queue until the errors are read by the system controller using the command
OUTPERRO
. The
OUTPERRO
command outputs one error message.
The error queue can only be cleared by performing an instrument preset or by
cycling the line power. In order to keep the queue up-to-date, it is important
to read all of the messages out of the queue each time errors are detected.
1-39
Writing Programs
Response to IEEE-488 Universal Commands
Response to IEEE-488 Universal Commands
Abort
Device Clear
Local
Local Lockout
Parallel Poll
Pass Control
The HP 8702D responds to the abort message (IFC) by halting all listener,
talker, and controller functions.
The HP 8702D responds to the device clear commands (DCL, SDC) by clearing the input and output queues, and clearing any HP-IB errors. The status
registers and the error queue are unaffected.
The HP 8702D will go into local mode if: the local command (GTL) is received,
the remote line is unasserted, or the front-panel
ing the HP 8702D’s HP-IB status from remote to local does not affect any of
the front-panel functions or values.
If the HP 8702D receives the local-lockout command (LLO) while it is in
remote mode, it will disable the entire front panel except for the line power
switch. A local-lockout condition can only be cleared by releasing the remote
line, although the local command (GTL) will place the instrument temporarily
in local mode.
The HP 8702D does not respond to parallel-poll configure (PPC) or parallelpoll unconfigure (PPU) messages.
If the HP 8702D is in pass-control mode, is addressed to talk, and receives the
take-control command (TCT) from the system, it will take active control of
the bus. If the HP 8702D is not requesting control, it will immediately pass
control to the system controller’s address.
LOCAL
key is pressed. Chang-
Remote
The HP 8702D will go into remote mode when the remote line is asserted and
the HP 8702D is addressed to listen. While the HP 8702D is held in remote
mode, all front-panel keys (with the exception of
ing the HP 8702D’s HP-IB status from remote to local does not affect any
front-panel settings or values.
1-40
LOCAL
) are disabled. Chang-
Writing Programs
Response to IEEE-488 Universal Commands
Serial Poll
Trigger
The HP 8702D will respond to a serial poll with its status byte, as defined in
the “The Status Byte” on page 1-36. To initiate the serial-poll sequence,
address the HP 8702D to talk and issue a serial-poll enable command (SPE).
Upon receiving this command, the HP 8702D will return its status byte. End
the sequence by issuing a serial-poll disable command (SPD). A serial poll
does not affect the value of the status byte, and it does not set the instrument
to remote mode.
In hold mode, the HP 8702D responds to device trigger by taking a single
sweep. If a one-path, 2-port measurement calibration is active, the HP 8702D
will set the waiting-for-Group-Execute-Trigger bits in the status byte. If waiting-for-forward-GET is set, the HP 8702D will assume the device is connected
for forward measurement and take a sweep when GET is received. Similarly, if
the waiting-for-reverse-GET bit is set, the HP 8702D will assume the device is
connected for reverse measurement. The HP 8702D responds only to
selected-device trigger (SDT). This means that it will not respond to group
execute-trigger (GET) unless it is addressed to listen. The HP 8702D will not
respond to GET if it is not in hold mode.
1-41
Writing Programs
Response to IEEE-488 Universal Commands
1-42
2
Examples
Examples
Programming Examples
Programming Examples
The examples documented in this chapter can be found on the disk that was
provided with your instrument. The example disk includes versions of these
programs for each of the following languages:
• HP BASIC (LIF format)
• Microsoft’s QuickBASIC (DOS format)
Microsoft
• Microsoft’s QuickC (DOS format)
For the HP BASIC language, examples are written for the HP 82335B interface
card.
For the QuickBASIC and QuickC languages, examples are provided for both
the HP 82335B Interface and Command Library card and the National Instruments card.
S11 1-Port Measurement Calibration2-8
Full 2-Port Measurement Calibration2-13
Data Transfer Using Markers2-18
Data Transfer Using ASCII Format 2-22
Data Transfer Using Floating-Point Numbers 2-25
Data Transfer Using Frequency-Array Information2-28
Data Transfer Using Internal Binary Format2-32
Using Error Queue 2-34
Generating Interrupts2-37
Power Meter Calibration2-41
Using the Learn String 2-45
Reading Calibration Data2-48
Using Instrument States 2-52
Setting a List Frequency Sweep2-56
Selecting a Single Segment2-61
Setting up Limit Lines2-65
Performing Pass/Fail Tests 2-69
Report
Generation
Operation Using Talker/Listener Mode 2-73
Controlling Peripherals 2-76
Printing Via the Serial Port2-80
Plotting Data2-83
Reading Plot Files from Disk2-86
Reading ASCII Instrument Files2-94
2-3
Examples
Preparing Measurement Settings
Preparing Measurement Settings
File Name
Description
EXAMP1A.BAS
Use the same command sequence used for manually setting up measurements
for remotely setting up measurements via HP-IB. There is no required order,
as long as you set the desired frequency range, number of points, and power
level prior to performing a measurement calibration.
This example sets the following parameters:
• reflection log magnitude on channel 1
• reflection phase on channel 2
• dual channel display mode
• frequency range from 100 MHz to 500 MHz
The following is the program’s algorithm:
• The system is initialized.
• The analyzer is adjusted to measure return loss on channel 1 and display it in
log magnitude.
• The analyzer is adjusted to measure return loss on channel 2 and display the
phase.
• The dual-channel display mode is activated.
• The system operator is prompted to enter the frequency range of the
measurement.
• The displays are autoscaled.
• The analyzer is released from remote control and the program ends.
This example program initializes the analyzer and the operator is queried for
the measurement’s start and stop frequencies. The analyzer is set up to display the S
over the selected frequency range. The displays are autoscaled and the program ends.
2-4
reflection measurement as a function of log magnitude and phase
11
Examples
Preparing Measurement Settings
10 ! This program selects the S-parameter to be measured, the display
20 ! format and then sets the specified start and stop frequencies.
30 ! The analyzer display is then autoscaled.
40 !
50 ! EXAMP1A
60 !
70 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
80 !
90 CLEAR SCREEN
100 ! Initialize the system
110 ABORT 7 ! Generate an IFC (Interface Clear)
120 CLEAR @Nwa ! SDC (Selected Device Clear) analyzer
130 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
140 ENTER @Nwa;Reply ! Read in the 1 returned
150 !
160 ! Set up measurement and display
170 OUTPUT @Nwa;”CHAN1;” ! Channel 1
180 OUTPUT @Nwa;”S11;” ! Return Loss measurement
190 OUTPUT @Nwa;”LOGM;” ! Log magnitude display
200 !
210 OUTPUT @Nwa;”CHAN2;” ! Channel 2
220 OUTPUT @Nwa;”S11;” ! Return Loss measurement
230 OUTPUT @Nwa;”PHAS;” ! Phase display
240 !
250 OUTPUT @Nwa;”DUACON;” ! Dual channel display
260 !
270 ! Request start and stop frequency
280 INPUT “ENTER START FREQUENCY (MHz):”,F_start
290 INPUT “ENTER STOP FREQUENCY (MHz):”,F_stop
300 !
310 ! Program the analyzer settings
320 OUTPUT @Nwa;”STAR”;F_start;”MHZ;” ! Set the start frequency
330 OUTPUT @Nwa;”STOP”;F_stop;”MHZ;” ! Set the stop frequency
340 !
350 ! Autoscale the displays
360 OUTPUT @Nwa;”CHAN1;AUTO;” ! Autoscale channel 1 display
370 OUTPUT @Nwa;”CHAN2;AUTO;” ! Autoscale channel 2 display
380 !
390 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
400 ENTER @Nwa;Reply ! Read the 1 when complete
410 LOCAL @Nwa ! Release HP-IB control
420 END
2-5
Examples
Verifying Measurement Settings
Verifying Measurement Settings
File Name
Description
EXAMP1B.BAS
This example shows how to read analyzer settings into your program. Information on the command formats and operations is located in Chapter 1, “Writing
Programs”. Appending a question mark (?) to a command that sets an analyzer parameter will return the value of that setting from the analyzer to the
controller. Parameters that are set as ON or OFF when queried will return a
one (1) if active or a zero (0) if OFF. Parameters are returned in ASCII format,
Form 4. This format varies in length from 1 to 24 characters-per-value. In
cases of marker or other multiple responses, these values are separated by
commas.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The number of points in the trace is queried and printed on the controller display.
• The start frequency is queried and printed on the controller display.
• The averaging function state is queried and printed on the controller display.
• The analyzer is released from remote control and the program ends.
The analyzer is preset. The preset values are returned for the number of
points, the start frequency, and the state of the averaging function. The analyzer is released from remote control and the program ends.
2-6
Examples
Verifying Measurement Settings
10 ! This program performs some example queries of analyzer
20 ! settings. The number of points in a trace, the start frequency
30 ! and, if averaging is turned on, are determined and displayed.
40 !
50 ! EXAMP1B
60 !
70 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
80 !
90 CLEAR SCREEN
100 ! Initialize the system
110 ABORT 7 ! Generate an IFC (Interface Clear)
120 CLEAR @Nwa ! SDC (Selected Device Clear)
130 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
140 ENTER @Nwa;Reply ! Read in the 1 returned
150 !
160 ! Query analyzer parameters
170 OUTPUT @Nwa;”POIN?;” ! Read in the default trace length
180 ENTER @Nwa;Num_points
190 PRINT “Number of points “;Num_points
200 PRINT
210 !
220 OUTPUT @Nwa;”STAR?;” ! Read in the start frequency
230 ENTER @Nwa;Start_f
240 PRINT “Start Frequency “;Start_f
250 PRINT
260 !
270 OUTPUT @Nwa;”AVERO?;” ! Averaging on?
280 ENTER @Nwa;Flag
290 PRINT “Flag =”;Flag;” “;
300 IF Flag=1 THEN ! Test flag and print analyzer state
310 PRINT “Averaging ON”
320 ELSE
330 PRINT “Averaging OFF”
340 END IF
350 !
360 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
370 ENTER @Nwa;Reply ! Read the 1 when complete
380 LOCAL @Nwa ! Release HP-IB control
390 END
2-7
Examples
S11 1-Port Measurement Calibration
S11 1-Port Measurement Calibration
File Name
Description
EXAMP2A.BAS
This section shows you how to coordinate a measurement calibration over
HP-IB. You can use the following sequence for performing either a manual
measurement calibration, or a remote measurement calibration via HP-IB:
1
Select the calibration type.
2
Measure the calibration standards.
3
Declare the calibration done.
The actual sequence depends on the calibration kit and changes slightly for
full 2-port measurement calibrations, which are divided into three calibration
sub-sequences.
Calibration Kits
The calibration kit tells the analyzer what standards to expect at each step of
the calibration. The set of standards associated with a given calibration is
termed a “class”. For example, measuring the short during an S
1-port mea-
11
surement calibration is one calibration step. All of the shorts that can be used
for this calibration step make up the class, which is called class S11B. For the
7-mm and 3.5-mm cal kits, class S11B uses only one standard. For Type-N cal
kits, class S11B contains two standards: male and female shorts.
When doing an S
calibration kit. Selecting
1-port measurement calibration, use a 7-mm or 3.5-mm
11
SHORT
automatically measures the short because the
class contains only one standard. When doing the same calibration in Type-N,
selecting
SHORT
brings up a second menu, allowing the operator to select
which standard in the class is to be measured. The sex listed refers to the test
port. If the test port is female, then the operator selects the female short
option.
Doing an S
1-port measurement calibration over HP-IB is very similiar. When
11
using a 7-mm or 3.5-mm calibration kit, sending CLASS11B will automatically
measure the short. In Type-N, sending CLASS11B brings up the menu with the
2-8
Examples
S11 1-Port Measurement Calibration
male and female short options. To select a standard, use STANA or STANB.
The STAN command is appended with the letters A through G, corresponding
to the standards listed under softkeys 1 through 7, softkey 1 being the topmost softkey.
The STAN command is OPC-compatible. A command that calls a class is only
OPC-compatible if that class has only one standard in it. If there is more than
one standard in a class, the command that calls the class brings up another
menu, and there is no need to query it.
Example
This example shows you how to coordinate an S
1-port measurement cali-
11
bration over HP-IB, using the HP 85032B 50Ω Type-N calibration kit.
1
Set up the desired instrument state.
2
Run the program.
3
Connect the standards as prompted.
Press
ENTER
on the controller keyboard to measure the standard.
4
NOTE
Some computers may have a RETURN hardkey as the activating switch for carriage
return/line feed. Throughout this section, the carriage-return/line-feed hardkey is represented by ENTER.
Information on selecting calibration standards can be found in Chapter 1,
“Writing Programs”.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The appropriate calibration kit is selected.
• The softkey menu is deactivated.
•The S
•The S
1-port measurement calibration sequence is run.
11
1-port measurement calibration data is saved.
11
• The softkey menu is activated.
• The analyzer is released from remote control and the program ends.
2-9
Examples
S11 1-Port Measurement Calibration
Running the Program
This program assumes the following test port characteristics:
• 50 ohm
• Type-N connectors
•Female
The prompts appear just above the message line on the analyzer’s and the controller’s display. Pressing
ENTER
on the controller continues the program and
measures the standard. The program displays a message when the measurement calibration is complete.
2-10
Examples
S11 1-Port Measurement Calibration
10 ! This program performs a 1-port calibration on the HP 8702D.
20 ! It guides the operator through a 1-port calibration
30 ! using the HP 85032B 50 ohm type N calibration kit.
40 !
50 ! The routine Waitforkey displays a message on the instrument’s
60 ! display and the console, to prompt the operator to connect the
70 ! calibration standard. Once the standard is connected, the
80 ! ENTER key on the computer keyboard is pressed to continue.
90 !
100 ! EXAMP2A
110 !
120 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
130 !
140 CLEAR SCREEN
150 ! Initialize the system
160 ABORT 7 ! Generate an IFC (Interface Clear)
170 CLEAR @Nwa ! SDC (Selected Device Clear)
180 !
190 OUTPUT @Nwa;”CALKN50;” ! Select CAL kit type
200 OUTPUT @Nwa;”MENUOFF;” ! Turn softkey menu off.
210 !
220 OUTPUT @Nwa;”CALIS111;” ! S11 1 port CAL initiated
230 !
240 CALL Waitforkey(“CONNECT OPEN AT PORT 1”)
250 OUTPUT @Nwa;”CLASS11A;” ! Open reflection CAL
260 OUTPUT @Nwa;”OPC?;STANB;” ! Select the second standard, B
270 ENTER @Nwa;Reply ! Read in the 1 returned
280 !
290 CALL Waitforkey(“CONNECT SHORT AT PORT 1”)
300 OUTPUT @Nwa;”CLASS11B;” ! Short reflection CAL
310 OUTPUT @Nwa;”OPC?;STANB;” ! Select the second standard, B
320 ENTER @Nwa;Reply ! Read in the 1 returned
330 !
340 CALL Waitforkey(“CONNECT LOAD AT PORT 1”)
350 OUTPUT @Nwa;”OPC?;CLASS11C;” ! Reflection load CAL
360 ENTER @Nwa;Reply ! Read in the 1 returned
370 !
380 OUTPUT 717;”PG;” ! Clear the analyzer display
390 !
400 DISP “COMPUTING CALIBRATION COEFFICIENTS”
410 !
420 OUTPUT @Nwa;”DONE;” ! Finished with the CAL cycle
430 OUTPUT @Nwa;”OPC?;SAV1;” ! Save the ONE PORT CAL
440 ENTER @Nwa;Reply ! Read in the 1 returned
450 !
460 DISP “S11 1-PORT CAL COMPLETED. CONNECT TEST DEVICE.”
470 OUTPUT @Nwa;”MENUON;” ! Turn on the softkey menu
480 !
490 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
500 ENTER @Nwa;Reply ! Read the 1 when complete
510 LOCAL @Nwa ! Release HP-IB control
520 !
530 END
540 !
550 ! **************************** Subroutines ******************************
560 !
2-11
Examples
S11 1-Port Measurement Calibration
570 Waitforkey: ! Prompt routine to read a keypress on the controller
580 SUB Waitforkey(Lab$)
590 ! Position and display text on the analyzer display
600 OUTPUT 717;”PG;PU;PA390,3700;PD;LB”;Lab$;”, PRESS ENTER WHEN READY_;”
610 !
620 DISP Lab$&” Press ENTER when ready”; ! Display prompt on console
630 INPUT A$ ! Read ENTER key press
640 !
650 OUTPUT 717;”PG;” ! Clear analyzer display
660 SUBEND
2-12
Full 2-Port Measurement Calibration
Full 2-Port Measurement Calibration
Examples
File Name
Description
EXAMP2B.BAS
The following example shows how to perform a full 2-port measurement calibration using the HP 85032B calibration kit. The main difference between this
example and the S
2-port measurement calibration process allows removal of both the forwardand reverse-error terms, so that all four S-parameters of the device under test
can be measured. PORT 1 is a female test port and PORT 2 is a male test port.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The appropriate calibration kit is selected.
• The softkey menu is deactivated.
• The 2-port calibration sequence is run.
• The operator is prompted to choose or skip the isolation calibration.
• The softkey menu is activated.
• The analyzer is released from remote control and the program ends.
Running the Program
The program assumes the following situation:
• test ports are Type-N
1-Port Measurement Calibration example is that the full
11
• PORT 1 is a female test port
• PORT 2 is a male test port
• HP 85032B 50Ω Type-N calibration kit is used
The prompts appear just above the message line on the analyzer’s display, as
well as the computer’s console. Pressing
tinues the program and measures the standard. You have the option of omitting the isolation portion of the measurement calibration. If you perform the
ENTER
on the computer keyboard con-
2-13
Examples
Full 2-Port Measurement Calibration
isolation portion of the calibration, averaging is automatically employed to
insure a valid calibration. The program will display a message when the measurement calibration is complete.
2-14
Examples
Full 2-Port Measurement Calibration
10 ! This program performs a full 2-port measurement calibration.
20 ! It guides the operator through a full 2-port calibration
30 ! using the HP 85032B 50 ohm type N calibration kit.
40 ! The routine Waitforkey displays a message on the instrument’s
50 ! display and the console to prompt the operator to connect the
60 ! calibration standard. Once the standard is connected, the
70 ! ENTER key on the computer keyboard is pressed to continue.
80 !
90 ! EXAMP2B
100 !
110 ASSIGN @Nwa TO 716 ! Assign an I/O path to the analyzer
120 !
130 CLEAR SCREEN
140 ! Initialize the analyzer
150 ABORT 7 ! Generate an IFC (Interface Clear)
160 CLEAR @Nwa ! SDC (Selected Device Clear)
170 !
180 OUTPUT @Nwa;”CALKN50;MENUOFF;” ! Select CAL kit type and turn off menu
190 !
200 OUTPUT @Nwa;”CALIFUL2;” ! Full 2 port CAL
210 !
220 OUTPUT @Nwa;”REFL;” ! Reflection CAL
230 !
240 CALL Waitforkey(“CONNECT OPEN AT PORT 1”)
250 OUTPUT @Nwa;”CLASS11A;” ! S11 open CAL
260 OUTPUT @Nwa;”OPC?;STANB;” ! Select the second standard, B
270 ENTER @Nwa;Reply ! Read in the 1 returned
280 !
290 CALL Waitforkey(“CONNECT SHORT AT PORT 1”)
300 OUTPUT @Nwa;”CLASS11B;” ! S11 short CAL
310 OUTPUT @Nwa;”OPC?;STANB;” ! Select the second standard, B
320 ENTER @Nwa;Reply ! Read in the 1 returned
330 !
340 CALL Waitforkey(“CONNECT LOAD AT PORT 1”)
350 OUTPUT @Nwa;”OPC?;CLASS11C;” ! S11 load CAL
360 ENTER @Nwa;Reply ! Read in the 1 returned
370 !
380 CALL Waitforkey(“CONNECT OPEN AT PORT 2”)
390 OUTPUT @Nwa;”CLASS22A;” ! S22 open CAL
400 OUTPUT @Nwa;”OPC?;STANA;” ! Select the first standard, A
410 ENTER @Nwa;Reply ! Read in the 1 returned
420 !
430 CALL Waitforkey(“CONNECT SHORT AT PORT 2”)
440 OUTPUT @Nwa;”CLASS22B;” ! S22 short CAL
450 OUTPUT @Nwa;”OPC?;STANA;” ! Select the first standard, A
460 ENTER @Nwa;Reply ! Read in the 1 returned
470 !
480 CALL Waitforkey(“CONNECT LOAD AT PORT 2”)
490 OUTPUT @Nwa;”OPC?;CLASS22C;” ! S22 load CAL
500 ENTER @Nwa;Reply
510 !
520 DISP “COMPUTING REFLECTION CALIBRATION COEFFICIENTS”
530 !
540 OUTPUT @Nwa;”REFD;” ! Reflection portion complete
550 !
560 OUTPUT @Nwa;”TRAN;” ! Transmission portion begins
2-15
Examples
Full 2-Port Measurement Calibration
570 !
580 CALL Waitforkey(“CONNECT THRU [PORT1 TO PORT 2]”)
590 DISP “MEASURING FORWARD TRANSMISSION”
600 OUTPUT @Nwa;”OPC?;FWDT;” ! Measure forward transmission
610 ENTER @Nwa;Reply ! Read in the 1 returned
620 !
630 OUTPUT @Nwa;”OPC?;FWDM;” ! Measure forward load match
640 ENTER @Nwa;Reply ! Read in the 1 returned
650 !
660 DISP “MEASURING REVERSE TRANSMISSION”
670 OUTPUT @Nwa;”OPC?;REVT;” ! Measure reverse transmission
680 ENTER @Nwa;Reply ! Read in the 1 returned
690 !
700 OUTPUT @Nwa;”OPC?;REVM;” ! Measure reverse load match
710 ENTER @Nwa;Reply ! Read in the 1 returned
720 !
730 OUTPUT @Nwa;”TRAD;” ! Transmission CAL complete
740 !
750 INPUT “SKIP ISOLATION CAL? Y OR N.”,An$
760 IF An$=”Y” THEN
770 OUTPUT @Nwa;”OMII;” ! Skip isolation cal
780 GOTO 940
790 END IF
800 !
810 CALL Waitforkey(“ISOLATE TEST PORTS”)
820 !
830 OUTPUT @Nwa;”ISOL;” ! Isolation CAL
840 OUTPUT @Nwa;”AVERFACT10;” ! Average for 10 sweeps
850 OUTPUT @Nwa;”AVEROON;” ! Turn on averaging
860 DISP “MEASURING REVERSE ISOLATION”
870 OUTPUT @Nwa;”OPC?;REVI;” ! Measure reverse isolation
880 ENTER @Nwa;Reply ! Read in the 1 returned
890 !
900 DISP “MEASURING FORWARD ISOLATION”
910 OUTPUT @Nwa;”OPC?;FWDI;” ! Measure forward isolation
920 ENTER @Nwa;Reply ! Read in the 1 returned
930 !
940 OUTPUT @Nwa;”ISOD;AVEROOFF;” ! Isolation complete averaging off
950 OUTPUT 717;”PG;” ! Clear analyzer display prompt
960 !
970 DISP “COMPUTING CALIBRATION COEFFICIENTS”
980 OUTPUT @Nwa;”DONE;” ! End the CAL sequence
990 OUTPUT @Nwa;”OPC?;SAV2;” ! Save THE TWO PORT CAL
1000 ENTER @Nwa;Reply ! Read in the 1 returned
1010!
1020 DISP “DONE WITH FULL 2-PORT CAL. CONNECT TEST DEVICE.”
1030 OUTPUT @Nwa;”MENUON;” ! Turn softkey menu on
1040 !
1050 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
1060 ENTER @Nwa;Reply ! Read the 1 when complete
1070 LOCAL @Nwa ! Release HP-IB control
1080!
1090 END
1100!
1110! ************************* Subroutines *******************************
1120!
2-16
Examples
Full 2-Port Measurement Calibration
1130 SUB Waitforkey(Lab$)
1140 ! Position and display prompt on the analyzer display
1150 OUTPUT 717;”PG;PU;PA390,3700;PD;LB”;Lab$;”, PRESS ANY KEY WHEN READY_;”
1160 !
1170 DISP Lab$&” Press ENTER when ready”; ! Display prompt on console
1180 INPUT A$ ! Read ENTER keypress on controller
1190 OUTPUT 717;”PG;” ! Clear analyzer display
1200 SUBEND
2-17
Examples
Data Transfer Using Markers
Data Transfer Using Markers
File Name
Description
EXAMP3A.BAS
There are two methods that can be used to read trace information from the
analyzer:
• selectively, using the trace markers
• completely, using the trace-data array
If only specific information (such as a single point on the trace or the result of
a marker search) is required, the marker output command can be used to read
the information.
Trace-Data Formats and Transfers
Refer to Table 1-5, “HP 8702D/Option 011 Array-Data Formats,” on page 1-19.
This table shows the number of bytes required to transfer a 201-point trace in
the different formats. As you will see in the first example Form 4, ASCII data is
the easiest to transfer, but the most time consuming due to the number of
bytes in the trace. If you are using a PC-based controller, a more suitable format would be Form 5. To use any trace data format other than Form 4 (ASCII
data) requires some care in transferring the data to the computer. Data types
must be matched to read the bytes from the analyzer directly in to the variable
array. The computer must be told to stop formatting the incoming data and
treat it as a binary-data transfer. All of the other data formats also have a four
byte header to deal with. The first two bytes are the ASCII characters
that indicate that a fixed length block transfer follows, and the next two bytes
form an integer containing the number of bytes in the block to follow. The
header must be read in to separate the header from the rest of the block data
to be mapped into an array. “Array-data formats” on page 1-18, discusses the
different types of formats and their compositions.
Data may also be transferred from several different locations in the trace-processing chain. These examples will illustrate formatted-data transfers, but
other locations in the trace-data processing chains may be accessed. Refer to
Figure 5-1 on page 5-5.
"#A"
2-18
Examples
Data Transfer Using Markers
In this section, an example of each of the data formats will be shown for comparison. A general rule of thumb is to use Form 1 (internal binary format) for
traces that are not being utilized for data content. Learn strings, state transfers, and calibration data that are being transferred to a file and back are good
examples. Refer to “Data Transfer Using Frequency-Array Information” on
page 2-28.
Arrays which will be interpreted or processed within your program should be
in Form 2, 3 or 5, whichever is appropriate for your computer. “Data Transfer
Using Floating-Point Numbers” on page 2-25 shows how to transfer a trace in
these formats.
In “Data Transfer Using ASCII Format” on page 2-22 and “Data Transfer Using
Floating-Point Numbers” on page 2-25, the frequency counterpart of each
data point in the array is also determined. Many applications generate a frequency and magnitude, or a phase array for the test results. Such data may be
required for other data processing applications (such as comparing data from
other measurements).
In “Data Transfer Using ASCII Format” on page 2-22, the frequency data is
constructed from the frequency span information. Alternatively, it is possible
to read the frequencies directly out of the instrument with the
command.
OUTPLIML
reports the limit-test results by transmitting the stimu-
OUTPLIML
lus point tested, a number indicating the limit-test results, and then the upper
and lower limits at that stimulus point (if available). The number indicating
the limit results is a –1 for no test, 0 for fail, and 1 for pass. If there are no limits available, the analyzer transmits zeros. For this example, we delete the
limit test information and keep the stimulus information.
In “Data Transfer Using Floating-Point Numbers” on page 2-25, the limit-test
array is read into the controller and used to provide the values directly from
the analyzer memory. Reading from the limit-test array is convenient,
although it outputs the results in ASCII format (Form 4), which may be slow. If
there is no other way to obtain the frequency data, this transfer time may be
acceptable. Frequency information becomes more difficult to determine when
not using the linear sweep mode. Log-frequency sweeps and list-frequency
sweeps have quite different values for each data point. For these special cases,
the additional time spent reading out the limit test results is an acceptable
solution for obtaining the valid frequency information for each data point in
the trace.
2-19
Examples
Data Transfer Using Markers
Example
Markers are the simplest form of trace-data transfer. You can position a
marker in the following locations on the trace:
• a frequency location
• an actual data point location
• a trace data value
The marker data is always returned in Form 4, ASCII format. Each number is
sent as a 24-character string; each character being a digit, sign, or decimal
point. In the case of markers, three numbers are sent. The display format
determines the values of the marker responses. Refer to Figure 5-1 on page
5-5 for additional information.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The selected frequency span is swept once.
• The marker is activated and placed on the maximum trace value.
• The three marker values (value 1, value 2, and stimulus) are output to the controller and displayed.
• The instrument is returned to local control and the program ends.
Running the Program
Execute the program. After performing an instrument preset, the analyzer
switches into the log-magnitude mode and measures the S
reflection values
11
of the device under test.
The three values returned to the controller are:
1
reflection, in dB
2
a non-significant value
3
the stimulus frequency at the maximum point
A non-significant value means that the analyzer returned a value that is meaningless in this data format.
Table 5-2 on page 5-6, provides an easy reference for the types of data
returned with the various data-format operational modes.
2-20
Examples
Data Transfer Using Markers
10 ! This program takes a sweep on the analyzer and turns on a marker.
20 ! The marker is positioned on the trace maximum and the marker data
30 ! is output in ASCII format.
40 !
50 ! EXAMP3A
60 !
70 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
80 !
90 CLEAR SCREEN
100 ! Initialize the analyzer
110 ABORT 7 ! Generate an IFC (Interface Clear)
120 CLEAR @Nwa ! SDC (Selective Device Clear)
130 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
140 ENTER @Nwa;Reply ! Read in the 1 returned
150 !
160 OUTPUT @Nwa;”OPC?;SING” ! Single sweep mode and wait
170 ENTER @Nwa;Reply ! Read 1 when sweep complete
180 !
190 OUTPUT @Nwa;”MARK1;” ! Turn on marker 1
200 OUTPUT @Nwa;”SEAMAX;” ! Find the maximum
210 !
220 OUTPUT @Nwa;”OUTPMARK;” ! Request the current marker value
230 ENTER @Nwa;Value1,Value2,Stim ! Read three marker values
240 !
250 ! Show the marker data received.
260 PRINT “ Value 1”,” Value 2”,” Stimulus (Hz)”
270 PRINT Value1,Value2,Stim ! Print the received values
280 PRINT
290 PRINT “ Compare the active marker block with the received values”
300 !
310 LOCAL @Nwa ! Release HP-IB control
320 END
2-21
Examples
Data Transfer Using ASCII Format
Data Transfer Using ASCII Format
File Name
Description
EXAMP3B.BAS
This example shows you how to transfer a trace array from the analyzer using
Form 4, an ASCII data transfer.
Table 5-2 on page 5-6 shows the relationship of the two values-per-point that
are transferred to the analyzer. When Form 4 is used, each number is sent as a
24-character string (each character represented by a digit, sign, or decimal
point). Since there are two numbers-per-point, plus a comma and line-feed, a
201-point transfer in Form 4 takes 10,050 bytes. This form is useful only when
input-data formatting is difficult with the instrument controller. Refer to Table
1-5, “HP 8702D/Option 011 Array-Data Formats,” on page 1-19 for a comparison with the other formats.
Another example is included with the ASCII data transfer. A fairly common
requirement is to create frequency-amplitude data pairs from the trace data.
No frequency information is included with the trace-data transfer. Relating the
data from a linear frequency sweep to frequency can be done by interrogating
the analyzer start frequency, the frequency span, and the number of points.
Given that information, the frequency of point n in a linear frequency sweep is
defined by the equation:
F=Start frequency + (n–1) × Span/(Points–1)
This example illustrates the technique of generating corresponding frequency
data. This is a straight-forward solution for linear uniform sweeps. For other
sweep types, frequency data is more difficult to construct and may be best
read from the analyzer directly from the limit-test array. See “Data Transfer
Using Frequency-Array Information” on page 2-28 for an example of this technique.
2-22
Examples
Data Transfer Using ASCII Format
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The trace-data array is allocated.
• The trace length is set to 11.
• The selected frequency span is swept once.
• The Form 4, ASCII format is set.
• The formatted trace is read from the analyzer.
• The frequency increments between the points are calculated.
• The marker is activated and placed at 30 kHz.
• The instrument is returned to local control and the program ends.
Running the Program
Run the program and watch the controller console. The analyzer will perform
an instrument preset. The program will then print out the data values received
from the analyzer. The marker is activated and placed at the left-hand edge of
the analyzer display. Position the marker with the knob and compare the values read with the active marker with the results printed on the controller console. The data points should agree exactly. Keep in mind that no matter how
many digits are displayed, the analyzer is specified to measure:
• magnitude to a resolution of 0.001 dB
• phase to a resolution of 0.01 degrees
• group delay to a resolution of 0.01 ps
Changing the display format will change the data sent with the
OUTPFORM
transfer. See Table 1-5, “HP 8702D/Option 011 Array-Data Formats,” on page
1-19 for a list of the specific data that is provided with each format. The data
OUTPFORM
from
reflects all the post processing such as:
• time domain
• gating
• electrical delay
• trace math
• smoothing
NOTE
Note that if time domain (option 110 only) is deactivated, operation is limited to 201
points in the lowpass mode.
2-23
Examples
Data Transfer Using ASCII Format
10 ! This program shows an ASCII format trace data transfer using form 4.
20 ! The data is received as a string of ASCII characters, 24 characters
30 ! per data point and transferred into a real array in the controller. The
40 ! corresponding frequency data is calculated from the analyzer settings.
50 !
60 ! EXAMP3B
70 !
80 ASSIGN @Nwa TO 716 ! Assign an I/O path to the analyzer
90 !
100 CLEAR SCREEN
110 ! Initialize
120 ABORT 7 ! Generate an IFC (Interface Clear)
130 CLEAR @Nwa ! SDC (Selective Device Clear)
140 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer
150 ENTER @Nwa;Reply ! Read the 1 when complete
160 !
170 ! Trace values are two elements per point, display format dependent
180 DIM Dat(1:11,1:2) ! Trace data array
190 !
200 OUTPUT @Nwa;”POIN 11;” ! Set trace length to 11 points
210 OUTPUT @Nwa;”OPC?;SING;” ! Single sweep mode and wait
220 ENTER @Nwa;Reply ! Read reply
230 !
240 OUTPUT @Nwa;”FORM4;” ! Set form 4 ASCII format
250 OUTPUT @Nwa;”OUTPFORM;” ! Send formatted trace to controller
260 ENTER @Nwa;Dat(*) ! Read in data array from analyzer
270 !
280 ! Now to calculate the frequency increments between points
290 OUTPUT @Nwa;”POIN?;” ! Read number of points in the trace
300 ENTER @Nwa;Num_points
310 OUTPUT @Nwa;”STAR?;” ! Read the start frequency
320 ENTER @Nwa;Startf
330 OUTPUT @Nwa;”SPAN?;” ! Read the span
340 ENTER @Nwa;Span
350 !
360 F_inc=Span/(Num_points-1) ! Calculate fixed frequency increment
370 !
380 PRINT “Point”,”Freq (MHz)”,” Value 1”,” Value 2”
390 IMAGE 3D,7X,5D.3D,3X,3D.4D,3X,3D.4D ! Formatting for controller display
400 !
410 FOR I=1 TO Num_points ! Loop through data points
420 Freq=Startf+(I-1)*F_inc ! Calculate frequency of data point
430 PRINT USING 390;I,Freq/1.E+6,Dat(I,1),Dat(I,2)! Print analyzer data
440 NEXT I
450 !
460 OUTPUT @Nwa;”MARKDISC;” ! Discrete marker mode
470 OUTPUT @Nwa;”MARK1 3E+4;” ! Position marker at 30 KHz
480 !
490 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
500 ENTER @Nwa;Reply ! Read the 1 when complete
510 LOCAL 7 ! Release HP-IB control
520 !
530 PRINT
540 PRINT “Position the marker with the knob and compare the values”
550 !
560 END
2-24
Data Transfer Using Floating-Point Numbers
Data Transfer Using Floating-Point Numbers
Examples
File Name
Description
EXAMP3C.BAS
This example program illustrates data transfer using Form 3 in which data is
transmitted in the floating-point formats. Form 2 is nearly identical except for
the IEEE 32-bit format of 4 bytes-per-value. Form 5 reverses the order of the
bytes to conform with the PC conventions for defining a real number.
The block-data formats have a four-byte header. The first two bytes are the
ASCII characters
and the next two bytes form an integer containing the number of bytes in the
block to follow. The header must be read in so that data order is maintained.
This transfer is more than twice as fast than a Form 4 transfer. With the
Form 4 transfer, 10,050 bytes are sent (201 points × 2 values-per-point × 24
bytes-per-value). Using Form 2 to transfer the data, only 1612 bytes are sent
(201 points × 2 values-per-point × 4 bytes-per-value). Refer to Table 1-5,
“HP 8702D/Option 011 Array-Data Formats,” on page 1-19 to compare the formats.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The integer variables are defined to contain the header information.
• The number of points in the trace is set to 11.
• The selected frequency span is swept once.
• Data-transfer format 3 is set.
• The headers are read from the trace.
• The array size is calculated and allocated.
• The trace data is read in and printed on the controller display.
• The marker is activated and placed at 30 kHz.
• The instrument is returned to local control and the program ends.
#A
that indicate that a fixed-length block transfer follows,
2-25
Examples
Data Transfer Using Floating-Point Numbers
Running the Program
Run the program. The computer displays the number of elements and bytes
associated with the transfer of the trace, as well as the first 10 data points.
Position the marker and examine the data values. Compare the received values with the analyzer’s marker values.
2-26
Examples
Data Transfer Using Floating-Point Numbers
10 ! This program shows how to read in a data trace in IEEE 64 bit
20 ! format. The array header is used to determine the length of the
30 ! array and to allocate the array size.
40 !
50 ! EXAMP3C
60 !
70 CLEAR SCREEN
80 ! Initialize the analyzer
90 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
100 ASSIGN @Nwadat TO 716;FORMAT OFF ! Binary data path definition
110 !
120 ABORT 7 ! Generate an IFC (Interface Clear)
130 CLEAR @Nwa ! SDC (Selected Device Clear)
140 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
150 ENTER @Nwa;Reply ! Read the 1 when completed
160 !
170 INTEGER Dheader,Dlength ! Integer variables for header info
180 Numpoints=11 ! Number of points in the trace
190 OUTPUT @Nwa;”POIN”;Numpoints;”;” ! Set number of points in trace
200 !
210 ! Set up data transfer
220 OUTPUT @Nwa;”OPC?;SING” ! Single sweep and wait
230 ENTER @Nwa;Reply ! Read the 1 when completed
240 !
250 OUTPUT @Nwa;”FORM3;” ! Select form 3 format
260 OUTPUT @Nwa;”OUTPFORM;” ! Send formatted output trace
270 !
280 ENTER @Nwadat;Dheader,Dlength ! Read headers from trace data
290 !
300 ALLOCATE Dat(1:Dlength/16,1:2) ! Use length to determine array size
310 ENTER @Nwadat;Dat(*) ! Read in trace data
320 !
330 PRINT “Size of array “;Dlength/16;” elements”
340 PRINT “Number of bytes “;Dlength
350 !
360 ! Print out the data array
370 PRINT “Element”,”Value 1”,” Value 2”
380 IMAGE 3D,6X,3D.4D,6X,3D.4D
390 FOR I=1 TO Numpoints ! Loop through the data points
400 PRINT USING 380;I,Dat(I,1),Dat(I,2)
410 NEXT I
420 !
430 OUTPUT @Nwa;”MARKDISC;” ! Discrete marker mode
440 OUTPUT @Nwa;”MARK1 3E+4;” ! Position marker at 30 KHz
450 !
460 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
470 ENTER @Nwa;Reply ! Read the 1 when complete
480 LOCAL @Nwa ! Release HP-IB control
490 !
500 PRINT
510 PRINT “Position the marker with the knob and compare the values.”
520 !
530 END
2-27
Examples
Data Transfer Using Frequency-Array Information
Data Transfer Using Frequency-Array
Information
File Name
Description
EXAMP3D.BAS
This example explains how to use the limit-test array to read the corresponding frequency values for the completed trace array into the controller. The
analyzer is set to sweep from 10 MHz to 200 MHz in log-frequency mode with
the number of points in the trace set to 11. This makes it very difficult to compute the frequency-point spacing in the trace. The points are equally spaced
across the trace, but not equally spaced in relation to frequency (because the
frequency span is displayed in a logarithmic scale, as opposed to a linear
scale). The limit-test data array may be read from the analyzer to provide the
frequency values for each data point. Four values are read for each data point
on the analyzer. The test results and limit values are not used in this example,
only the frequency values are used. This technique is the only method of
obtaining the non-linear frequency data from the analyzer display. The test
data and frequencies are printed on the controller display and the marker is
enabled to allow the operator to examine the actual locations on the analyzer
display.
2-28
Data Transfer Using Frequency-Array Information
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The integer variables for the header information are defined.
• The number of points in the trace is set to 11.
• The frequency span (10 MHz to 200 MHz) is selected.
• The log-frequency sweep is selected.
• The data-transfer format 3 is set.
• The headers are read from the trace.
• The array size is calculated and allocated.
• The trace data is read in.
• The limit-test array is calculated and allocated.
• The limit-line test array is read in.
• The table header is printed.
• The program cycles through the trace values.
• The trace data and frequency are printed.
• The discrete-marker mode is activated.
• The marker is activated and placed at 10 MHz.
• The instrument is returned to local control and the program ends.
Running the Program
Run the program. Observe the controller display. The corresponding frequency values are shown with the trace-data values. Position the marker and
observe the relationship between the frequency values and the point spacing
on the trace. Compare the trace-data values on the analyzer with those
received by the controller.
Examples
2-29
Examples
Data Transfer Using Frequency-Array Information
10 ! This program shows how to read in a trace and create the frequency
20 ! value associated with the trace data value. EXAMP3C is used to
30 ! read in the data from the analyzer. The start and stop
40 ! frequencies are set to provide two decades of log range. Log sweep
50 ! is set and the frequency data points are read from the limit test
60 ! array and displayed with the data points.
70 !
80 ! EXAMP3D
90 !
100 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
110 ASSIGN @Nwadat TO 716;FORMAT OFF ! Binary path for data transfer
120 !
130 CLEAR SCREEN
140 ! Initialize the analyzer
150 ABORT 7 ! Generate an IFC (Interface Clear)
160 CLEAR @Nwa ! SDC (Selective Device Clear)
170 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
180 ENTER @Nwa;Reply ! Read the 1 when completed
190 !
200 INTEGER Dheader,Dlength ! Integer variables for header info
210 !
220 OUTPUT @Nwa;”POIN 11;” ! Set trace length to 11 points
230 OUTPUT @Nwa;”STAR 10.E+6;” ! Start frequency 10 MHz
240 OUTPUT @Nwa;”STOP 200.E+6;” ! Stop frequency 200 MHz
250 OUTPUT @Nwa;”LOGFREQ;” ! Set log frequency sweep
260 !
270 ! Set up data transfer
280 OUTPUT @Nwa;”OPC?;SING” ! Single sweep and wait
290 ENTER @Nwa;Reply ! Read the 1 when completed
300 !
310 OUTPUT @Nwa;”FORM3;” ! Select form 3 trace format
320 OUTPUT @Nwa;”OUTPFORM;” ! Output formatted trace
330 !
340 ENTER @Nwadat;Dheader,Dlength ! Read headers from trace data
350 !
360 ALLOCATE Dat(1:Dlength/16,1:2) ! Use length to determine array size
370 ENTER @Nwadat;Dat(*) ! Read in trace data
380 !
390 ! Create the corresponding frequency values for the array
400 !
410 ! Read the frequency values using the limit test array
420 ALLOCATE Freq(1:Dlength/16,1:4) ! Limit line results array
430 ! Limit line values are frequency, test results, upper and lower limits
440 !
450 OUTPUT @Nwa;”OUTPLIML;” ! Request limit line test results
460 ENTER @Nwa;Freq(*) ! Read 4 values per point
470 !
480 ! Display table of freq and data
490 !
500 PRINT “ Freq (MHz)”,”Mag (dB)” ! Print table header
510 FOR I=1 TO 11 ! Cycle through the trace values
520 Freqm=Freq(I,1)/1.E+6 ! Convert frequency to MHz
530 PRINT USING “4D.6D,9X,3D.4D”;Freqm,Dat(I,1) ! Print trace data
540 NEXT I
550 !
560 ! Set up marker to examine frequency values
2-30
Examples
Data Transfer Using Frequency-Array Information
570 OUTPUT @Nwa;”MARKDISC;” ! Discrete marker mode
580 OUTPUT @Nwa;”MARK1 10.E+6;” ! Turn on marker and place at 10 MHz
590 !
600 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
610 ENTER @Nwa;Reply ! Read the 1 when complete
620 LOCAL @Nwa ! Release HP-IB control
630 PRINT ! Blank line
640 PRINT “Position marker and observe frequency point spacing”
650 !
660 END
2-31
Examples
Data Transfer Using Internal Binary Format
Data Transfer Using Internal Binary Format
File Name
Description
EXAMP3E.BAS
Form 1 is used for rapid I/O transfer of analyzer data. It contains the least
number of bytes-per-trace and does not require reformatting in the analyzer.
This format is more difficult to convert into a numeric array in the controller.
Analyzer-state information, such as learn strings and calibration arrays, may
be easily transferred in this format because data conversion is not required.
Recalling an instrument state that has been stored in a file and transferring
instrument-state information to the analyzer are excellent applications of a
Form 1 data transfer.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The integer variables for the header information are defined.
• The string variable for the header is defined.
• The selected frequency span is swept once.
• The internal-binary format is selected.
• The error-corrected data is output from the analyzer.
• The two data-header characters and the two length bytes are read in.
• The string buffer is allocated for data.
• The trace data is read into the string buffer.
• The analyzer is restored to continuous-sweep mode and queried for command
completion.
• The instrument is returned to local control and the program ends.
Running the Program
Run the program. The analyzer is initialized. The header and the number of
bytes in the block transfer are printed on the controller display. Once the
transfer is complete, the number of bytes in the data string is printed. Compare the two numbers to be sure that the transfer was completed.
2-32
Examples
Data Transfer Using Internal Binary Format
10 ! This program is an example of a form 1, internal format data
20 ! transfer. The data is stored in a string dimensioned to the
30 ! length of the data being transferred.
40 !
50 ! EXAMP3E
60 !
70 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
80 ASSIGN @Nwa_bin TO 716;FORMAT OFF ! Binary path for data transfer
90 !
100 CLEAR SCREEN
110 ! Initialize the analyzer
120 ABORT 7 ! Send IFC (Interface Clear)
130 CLEAR @Nwa ! SDC (Selective Device Clear)
140 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
150 ENTER @Nwa;Reply ! Read the 1 when completed
160 !
170 INTEGER Length ! Header length 2 bytes
180 DIM Header$[2] ! Header string 2 bytes
190 !
200 OUTPUT @Nwa;”OPC?;SING;” ! Single sweep and wait
210 ENTER @Nwa;Reply ! Read the 1 when completed
220 !
230 OUTPUT @Nwa;”FORM1;” ! Select internal binary format
240 OUTPUT @Nwa;”OUTPDATA;” ! Output error corrected data
250 !
260 ! Read in the data header two characters and two bytes for length
270 ! “#,2A”
280 ! # no early termination, terminate when ENTER is complete
290 ! 2A read two chars
300 !
310 ENTER @Nwa_bin USING “#,2A”;Header$ ! Read header as 2 byte string
320 ENTER @Nwa_bin;Length ! Read length as 2 byte integer
330 PRINT “Header “;Header$,”Array length”;Length
340 !
350 ALLOCATE Data$[Length] ! String buffer for data bytes
360 ! “+,-K” format statement
370 ! + EOI as a terminator LF is suppressed and read as data
380 ! -K All characters are read and not interpreted LF is included
390 ENTER @Nwa_bin USING “+,-K”;Data$ ! Read trace into string array
400 !
410 PRINT “Number of bytes received “;LEN(Data$)
420 !
430 OUTPUT @Nwa;”CONT;” ! Restore continuous sweep
440 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
450 ENTER @Nwa;Reply ! Read the 1 when complete
460 !
470 LOCAL @Nwa ! Release HP-IB control
480 END
2-33
Examples
Using Error Queue
Using Error Queue
File Name
Description
EXAMP4A.BAS
The error queue holds up to 20 instrument errors and warnings in the order
that they occurred. Each time the analyzer detects an error condition, the
analyzer displays a message on the analyzer’s display, and puts the error in the
error queue. If there are any errors in the queue, bit 3 of the status byte will be
set. The errors can be read from the queue with the
OUTPERRO
the oldest error in the queue.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The error-message string is allocated.
• The analyzer is released from remote control.
• The program begins an endless loop to read the error queue.
• The status byte is read with a serial poll.
• The program tests to see if an error is present in the queue.
• The error-queue bit is set.
• The program requests the contents of the error queue.
• The error number and string are read.
• The error messages are printed until there are no more errors in the queue.
• The instrument is returned to local control.
• The controller emits a beep to attract the attention of the operator and resumes
searching for errors.
causes the analyzer to transmit the error number and message of
OUTPERRO
command.
Running the Program
Run the program. The analyzer goes through the preset cycle. Nothing will
happen at first. The program is waiting for an error condition to activate the
error queue. To cause an error, press a blank softkey. The message
INVALID KEY
and print two error messages. The first line will be the invalid key error message, and the second line will be the
queue, you can either loop until the
2-34
will appear on the analyzer’s display. The computer will beep
NO ERRORS
NO ERRORS
message. To clear the error
message is received, or until
CAUTION:
Examples
Using Error Queue
the bit in the status register is cleared. In this case, we wait until the status bit
in the status register is clear. Note that while the program is running, the analyzer remains in the local mode and the front-panel keys may be accessed.
The error queue will hold up to 20 errors until all the errors are read out or the
instrument is preset. It is important to clear the error queue whenever errors
are detected. Otherwise, old errors may be mistakenly associated with the
current instrument state.
SYSTEM
Press
and then the unlabeled key several times quickly and watch the
display. The number of errors observed should correspond to the number of
times you pressed the key.
As another example, press
RESPONSE
calibration. Press
CAL,
then the
DONE: RESPONSE
CALIBRATE MENU
key. Select the
without performing any calibrations. Note the error message on the analyzer and on the controller display.
Push the
THRU
key and then
DONE: RESPONSE
. We are not concerned with the
validity of the calibration, just setting a simple calibration on the analyzer.
Note that
press
COR
is displayed in the upper left-hand section of the graticule. Now,
START
and ↑. This will generate an error because the start frequency has
been changed, invalidating the calibration. This error is reported on the controller display as well. A complete list of error messages and their descriptions
can be found in "Error Messages" in the
HP 8702D Reference
manual.
The program is in an infinite loop waiting for errors to occur. End the program
by pressing
RESET
or
BREAK
on the controller keyboard.
NOTE
Not all messages displayed by the analyzer are put in the error queue; operator prompts
and cautions are not included.
2-35
Examples
Using Error Queue
10 ! This program is an example of using the error queue to detect
20 ! errors generated by the analyzer. The status byte is read and
30 ! bit 3 is tested to determine if an error exists. The error queue
40 ! is printed out and emptied.
50 !
60 ! EXAMP4A
70 !
80 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
90 !
100 CLEAR SCREEN
110 ! Initialize the analyzer
120 ABORT 7 ! Generate an IFC (Interface Clear)
130 CLEAR @Nwa ! SDC (Selective Device Clear)
140 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
150 ENTER @Nwa;Reply ! Read the 1 when complete
160 !
170 DIM Error$[50] ! String for analyzer error message
180 !
190 LOCAL @Nwa ! Release analyzer from remote control
200 !
210 LOOP ! Endless loop to read error queue
220 REPEAT
230 Stat=SPOLL(@Nwa) ! Read status byte with serial poll
240 UNTIL BIT(Stat,3) ! Test for error queue present
250 !
260 ! Error queue bit is set
270 REPEAT ! Loop until error number is 0
280 OUTPUT @Nwa;”OUTPERRO;” ! Request error queue contents
290 ENTER @Nwa;Err,Error$ ! Read error number and string
300 PRINT Err,Error$ ! Print error messages
310 UNTIL Err=0 ! No more errors in queue
320 !
330 LOCAL @Nwa ! Release analyzer from remote
340 BEEP 600,.2 ! Beep to attract attention
350 END LOOP ! Repeat error search
360 !
370 END
2-36
Generating Interrupts
Examples
Generating Interrupts
File Name
Description
EXAMP4B.BAS
Interrupts can be generated using the status-reporting mechanism. The status-byte bits can be enabled to generate a service request (SRQ) when set. In
turn, the instrument controller can be set up to generate an interrupt on the
SRQ and respond to the condition which caused the SRQ.
To generate an SRQ, a bit in the status byte is enabled using the
mand. A one (1) in a bit position enables that bit in the status byte. Hence,
ESNBn
SRE 8;
;
enables an SRQ on bit 3, the check-error queue, since the
enables bits in event-status-register B so that they will be summa-
ESE 32;SRE 32;
enables the syntax-error bit. When the
executing
decimal value 8 equals 00001000 in binary representation. Whenever an error
is put into the error queue and bit 3 is set, the SRQ line is asserted, illuminating the (S) indicator in the HP-IB status block on the front panel of the analyzer. The only way to clear the SRQ is to disable bit 3, re-enable bit 3, or read
out all the errors from the queue.
A bit in the event-status register can be enabled so that it is summarized by
bit 5 of the status byte. If any enabled bit in the event-status register is set,
bit 5 of the status byte will also be set. For example, executing
enables bits 1 and 6 of the event-status register, since in binary, the decimal
number 66 equals 01000010. Hence, whenever active control is requested or a
front-panel key is pressed, bit 5 of the status byte will be set. Similarly, executing
rized by bit 2 in the status byte.
To generate an SRQ from an event-status register, enable the desired eventstatus-register bit. Then enable the status byte to generate an SRQ. For
instance, executing
syntax-error bit is set, the summary bit in the status byte will be set. This will,
in turn, enable an SRQ on bit 5 of the status byte, the summary bit for the
event-status register.
SREn;
ESE 66;
com-
2-37
Examples
Generating Interrupts
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The status registers are cleared.
• The event-status register bit 5 is enabled.
• The status-register bit 5 is enabled.
• The interrupt pointer is enabled and points to a subroutine.
• A bad command is sent to the analyzer to generate errors.
• The controller reads a serial-poll byte from HP-IB in the event of an interrupt.
• The program tests for an SRQ.
• If the SRQ is not generated by the analyzer, the subroutine stops and displays,
SRQ FROM OTHER DEVICE
.
• If the SRQ was generated by the analyzer, the program reads the status byte
and event-status register.
• If bit 5 in the event-status register is set, program prints,
FROM ANALYZER
.
• If bit 5 in the event-status register is NOT set, program prints,
BIT NOT SET.
SYNTAX ERROR
SYNTAX ERROR
• The SRQ interrupt is re-enabled on the bus.
• At the finish, the interrupt is deactivated.
• The analyzer is released from remote control and the program ends.
Running the Program
Run the program. The computer will preset the analyzer, then pause for a second or two. After pausing, the program sends an invalid command string,
STIP 2GHZ;
2 GHZ;
, to cause a syntax error. This command is intended to be,
. The computer will display a series of messages from the SRQ-han-
dler routine. The analyzer will display
CAUTION: SYNTAX ERROR
STOP
and the
incorrect command, pointing to the first character it did not understand.
The SRQ can be cleared by reading the event-status register and clearing the
latched bit, or by clearing the enable registers with the
CLES;
command. The
syntax-error message on the analyzer display can only be cleared by the HP-IB
Device Clear (DCL) message or Selected Device Clear (SDC) message. Device
Clear is not commonly used because it clears every device on the bus.
Selected Device Clear can be used to reset the input and output queue and
the registers of a specific instrument on the bus. This will also clear all the
interrupt definitions.
2-38
Examples
Generating Interrupts
10 ! This program is an example of using an SRQ based interrupt to
20 ! detect an error condition in the analyzer. In this example, a
30 ! syntax error is generated with an invalid command. The status byte
40 ! is read in and tested. The error queue is read, printed out and
50 ! then cleared.
60 !
70 ! EXAMP4B
80 !
90 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
100 !
110 CLEAR SCREEN
120 ! Initialize the analyzer
130 ABORT 7 ! Generate an IFC (Interface Clear)
140 CLEAR @Nwa ! SDC (Selective Device Clear)
150 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
160 ENTER @Nwa;Reply ! Read the one from the analyzer
170 !
180 DIM Error$[50] ! String for analyzer error message
190 ! Set up syntax error interrupt
200 OUTPUT @Nwa;”CLES;” ! Clear the status registers
210 !
220 ! Generate SRQ when bit 5 is set
230 OUTPUT @Nwa;”ESE 32;” ! Event status register bit 5 enabled
240 !
250 ! Generate bit 5 in status register when syntax error occurs
260 OUTPUT @Nwa;”SRE 32;” ! Status register bit 5 enabled
270 !
280 ! Setup the interrupt pointer to a subroutine
290 ON INTR 7 GOSUB Srq_det ! When interrupt occurs go to Srq_det
300 Stat=SPOLL(@Nwa) ! Clear any pending SRQs
310 ENABLE INTR 7;2 ! Set interrupt on HP-IB bit 2 (SRQ)
320 !
330 DISP “Waiting for bad syntax”
340 WAIT 2 ! Pause for 2 seconds
350 !
360 OUTPUT @Nwa;”STIP 2GHZ;;” ! Send bad STOP command syntax
370 !
380 WAIT 2 ! Pause for 2 seconds
390 DISP ““ ! Clear display line
400 GOTO Finish ! Exit program example
410 !
420 !************************** Subroutines ******************************
430 !
440 Srq_det: ! SRQ handler
450 Stat=SPOLL(@Nwa) ! Read serial poll byte from HP-IB
460 PRINT “Stat from Serial Poll”;Stat
470 IF BIT(Stat,6) THEN ! Test for SRQ
480 PRINT “SRQ received from analyzer”
490 ELSE ! No SRQ from analyzer
500 PRINT “SRQ from other device”
510 STOP ! Stop if not from analyzer
520 END IF
530 !
540 IF BIT(Stat,5) THEN ! Event status register bit set
550 PRINT “Event Status Register caused SRQ”
560 ELSE ! Some other bit set
2-39
Examples
Generating Interrupts
570 PRINT “Some other bit caused the SRQ”
580 STOP ! Stop if bit not set
590 END IF
600 !
610 REPEAT
620 OUTPUT @Nwa;”OUTPERRO;” ! Read analyzer error queue
630 ENTER @Nwa;Err,Error$ ! Read error number and string
640 PRINT Err,Error$ ! Print error message
650 UNTIL Err=0 ! No more errors in queue
660 !
670 PRINT ! White space
680 ENABLE INTR 7;2 ! Re-enable SRQ interrupt on HP-IB
690 RETURN
700 !
710 !************************** End Subroutines ******************************
720 !
730 Finish: ! End of program and exit
740 DISP “Finished”
750 OFF INTR 7 ! Turn off interrupt
760 LOCAL @Nwa ! Release HP-IB control
770 END
2-40
Power Meter Calibration
Examples
Power Meter Calibration
File Name
Description
EXAMP4C.BAS
For increased accuracy of the analyzer’s
calibration is available. This measurement-accuracy enhancement technique
is described in the "Error Messages" section of the
ual. The example described will perform the sample and sweep calibration
under HP-IB remote control.
The power meter is usually connected to
ments. Its address must be set correctly and it must be connected to the
HP-IB. The power meter address can be set by pressing:
ADDRESS P MTR/HPIB
plete the process. The appropriate command must be selected for the model
number of the power meter being used. Press
being used is displayed between the brackets. The correction factors for the
power sensor are entered into the analyzer. All of these steps are explained in
the "Error Messages" section of the
The number of readings-per-point must also be selected before starting. The
number of points directly affects the measurement time of the calibration
sequence. The power meter must interact with the analyzer for each of the
selected points and read the number of values specified for each trace point.
Typically, two readings-per-point is considered appropriate. More than two
readings-per-point could lead to unacceptable processing time.
To control a power meter calibration via HP-IB, the analyzer must be set to
pass-control mode. The analyzer must position the local oscillator to a point in
the sweep and read the power present at the power meter sensor. For this
operation to take place, the system controller must set up the measurement
and then pass control to the analyzer to read each data point in the sweep.
After reading the data point from the power meter, the analyzer passes control
back to the system controller. The analyzer then sets up to measure the next
point and again requests control from the system controller. This process continues until the analyzer signals that the entire sweep has been measured
point-by-point.
and using the ↑ and ↓ keys or the numeric key pad to com-
PORT
1-output power, a power meter
HP 8702D Reference
PORT
1 for the forward measure-
POWER MTR: [ ]
HP 8702D Reference
LOCAL
SET ADDRESSES,
,
until the model
manual.
man-
2-41
Examples
Power Meter Calibration
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The number of points in the trace is set.
• The number of readings-per-point is set.
• The frequency span is set.
• The reference channel is measured.
• The power meter-calibration array is allocated.
• The power meter model is chosen.
• The status registers are cleared.
• The request-control summary bit is enabled.
• The pass-control mode is enabled.
• A calibration sweep is taken to begin the sequence.
• The status byte is read until control is requested.
• The computer passes control to the analyzer.
• The display is cleared and the analyzer is set to talker/listener mode.
• The HP-IB interface status is read until control is returned.
• The program loops until all the points have been measured.
• The power meter calibration is enabled.
• The calibration data is output to the controller in Form 4, ASCII format.
• The power meter-calibration factors are read into the controller.
• The analyzer is released from remote control and the program ends.
Running the Program
The analyzer is preset and the power meter-calibration routine begins. The
analyzer displays the message,
WAITING FOR HP-IB CONTROL
requesting control. The system controller display prints,
trol,
when control is passed to the analyzer. The controller displays,
ing for request
,
while the analyzer has control and is reading the power
Passing Con-
,
when it is
Wait-
meter.
The interaction of the messages and the movement of the cursor allow observation of the calibration process. Once the calibration is complete, the analyzer displays,
POWER METER CAL IS COMPLETE
controller displays,
Finished with Power meter Cal
,
and the system
.
The power meter-calibration mode (with one sweep of correction data) is
enabled and the calibration is switched ON. At the completion of the program,
talker/listener mode is restored, the event-status registers are cleared (to halt
the status-byte interaction), the power meter correction factors are displayed,
the sweep is placed in continuous-sweep mode, the analyzer is released from
HP-IB control, and the program ends.
2-42
Examples
Power Meter Calibration
10 ! This routine does a power meter cal using pass control.
20 ! A measurement cycle takes place on each point of the trace. The
30 ! point is measured by the power meter and the measured value read
40 ! into the analyzer. The command TAKCS; arms this measurement mode.
50 ! The number of measurements is determined by the number of points in
60 ! the trace, the number of readings per point and an extra measurement
70 ! cycle to release the power meter.
80 ! Control is passed to the analyzer, the point is measured and
90 ! the data is transferred to the analyzer. Control is passed back to
100 ! the controller and the cycle begins again. Serial poll is used to
110 ! read the status byte of the analyzer and test the logic.
120 ! The HP-IB interface status register is monitored to determine when
130 ! control is returned to the interface from the analyzer.
140 !
150 ! EXAMP4C
160 !
170 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
180 !
190 CLEAR SCREEN
200 ! Initialize the analyzer
210 ABORT 7 ! Generate an IFC (Interface Clear)
220 CLEAR @Nwa ! SDC (Selective Device Clear)
230 OUTPUT @Nwa;”OPC?;PRES;” ! Preset the analyzer and wait
240 ENTER @Nwa;Reply ! Read the 1 when complete
250 !
260 INTEGER Stat
270 !
280 ! Set up the analyzer parameters
290 Numpoints=11 ! Number of points in the trace
300 Numreads=2 ! Number of readings per point
310 Startf=1.00E+8 ! Start frequency
320 Stopf=5.0E+8 ! Stop frequency
330 !
340 OUTPUT @Nwa;”POIN”;Numpoints;”;” ! Set trace length to numpoints
350 OUTPUT @Nwa;”NUMR”;Numreads;”;” ! Set number of readings per point
360 OUTPUT @Nwa;”STAR”;Startf ! Set start frequency
370 OUTPUT @Nwa;”STOP”;Stopf ! Set stop frequency
380 OUTPUT @Nwa;”MEASR;” ! Measure the reference channel
390 !
400 ALLOCATE Pmcal(1:Numpoints) ! Create power meter cal array
410 !
420 ! Store the original trace for comparison
430 OUTPUT @Nwa;”DATI;”
440 OUTPUT @Nwa;”DISPDATM;”
450 OUTPUT @Nwa;”AUTO;”
460 !
470 ! Select the power meter being used for cal
480 ! OUTPUT @Nwa;”POWM ON;” ! Select 436A power meter
490 OUTPUT @Nwa;”POWMOFF;DEBUON;” ! Select 437B/438A power meter
500 !
510 ! Set analyzer HP-IB, status regs to interrupt on pass control
520 OUTPUT @Nwa;”CLES;” ! Clear status registers
530 OUTPUT @Nwa;”ESE2;” ! Enable request control summary bit
540 OUTPUT @Nwa;”SRE32;” ! SRQ on events status register
550 !
560 PRINT “Beginning Power Meter CAL”
2-43
Examples
Power Meter Calibration
570 OUTPUT @Nwa;”USEPASC;” ! Enable pass control operation
580 OUTPUT @Nwa;”TAKCS;” ! Take Cal Sweep
590 !
600 FOR I=1 TO Numpoints*Numreads+1 ! Points * Number of readings plus 1
610 ! Serial poll does not place analyzer in remote operation
620 ! and does not require the analyzer to process the command.
630 !
640 REPEAT ! Repeat until SRQ detected
650 Stat=SPOLL(@Nwa) ! Serial poll to read status byte
660 DISP “Stat “;Stat;” Waiting for request”
670 UNTIL BIT(Stat,6) ! SRQ detected for request control
680 OUTPUT @Nwa;”ESR?;” ! Read status register to clear
690 ENTER @Nwa;Reply ! Read and discard register value
700 !
710 PRINT “Passing Control” ! status read and passing control
720 PASS CONTROL @Nwa ! Pass control to analyzer
730 !
740 REPEAT
750 ! Read HP-IB interface state information register.
760 STATUS 7,6;Hpib ! Test HP-IB register for control
770 !
780 ! Reading the interface status register does not interact with the
790 ! analyzer. Bit 6 is set when control is returned.
800 !
810 DISP “Waiting for control”
820 UNTIL BIT(Hpib,6) ! Loop until control is returned
830 NEXT I
840 !
850 PRINT “Finished with Power meter Cal”
860 DISP ““ ! Clear display message
870 !
880 OUTPUT @Nwa;”TALKLIST;” ! Restore Talker/Listener operation
890 OUTPUT @Nwa;”CLES;” ! Clear and reset status byte operation
900 !
910 OUTPUT @Nwa;”PWMCONES;” ! Power meter cal correct one sweep
920 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
930 ENTER @Nwa;Reply ! Read the 1 when complete
940 !
950 ! Read the power meter cal correction factors
960 OUTPUT @Nwa;”FORM4;” ! ASCII data format to read cal data
970 OUTPUT @Nwa;”OUTPPMCAL1;” ! Request the power meter cal factors
980 ENTER @Nwa;Pmcal(*) ! Read the factors
990 !
1000! Display the power meter cal factors
1010 PRINT “Point”,”Factor”
1020 FOR I=1 TO Numpoints ! Cycle throught the factors
1030 PRINT I,Pmcal(I)
1040 NEXT I
1050!
1060 LOCAL @Nwa ! Release HP-IB control
1070 END
2-44
Using the Learn String
Examples
Using the Learn String
File Name
Description
EXAMP5A.BAS
This section provides several different examples of performing analyzer system setups.
NOTE
The most efficient option for storing and recalling analyzer states is using the analyzer’s
internal registers to save the CAL data. Recalling these registers is the fastest solution
to restoring analyzer setups. Refer to “Chapter 8, “Saving Data, States, and the Display”
in the
HP 8702D User’s Guide
registers. In the event that all the registers have been used, the internal disk drive is not
used, or if internal memory limitations exist, then these external solutions become viable.
The purpose of this example is to demonstrate several programming options
for storing and recalling entire instrument states over HP-IB. The examples
describe two different processes for storing and recalling instrument states.
The first example accomplishes the task using the learn string. The second
example involves reading both the learn string and the calibration arrays out
of the analyzer and storing them to disk or storing them in the system controller itself.
Using the learn string is a very rapid way of saving the instrument state, but
using direct disk access has the advantage of automatically storing calibrations, cal kits, and data along with the instrument state.
A complete analyzer setup requires sending the learn string and a calibration
array to set the analyzer parameters. The CAL array may also be placed in the
analyzer, just as if a calibration was performed. By sending both sets of data,
the analyzer may be quickly setup for a measurement.
for detailed information on the analyzer’s internal storage
2-45
Examples
Using the Learn String
Several different measurements may be required in the course of testing a
device. An efficient way of performing multiple measurements is to send both
the calibration array and the learn string, and then perform the measurements.
Example
The learn string is a very fast and easy way to read an instrument state. The
learn string includes all front-panel settings, the limit table for each channel,
and the list-frequency table. It can be read out of the analyzer with the command
OUTPLEAS
, and input to the analyzer with the command
INPULEAS
This array is always transmitted in Form 1, the internal format for the analyzer. It cannot be longer than 3000 bytes. The example for a Form 1 transfer
could also have been used. However, the “Using the Learn String” example is
the simplest solution for reading the learn string from the analyzer.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The string storage is allocated.
• The learn string is requested.
• The string is read without any processing.
• The analyzer is released from remote control.
• The instrument state is changed by the operator.
• The learn string is sent back to the analyzer.
• The analyzer is released from remote control and the program ends.
Running the Program
Run the program. When the program stops, change the instrument state and
ENTER
press
on the controller. The analyzer will be returned to its original state
by sending the learn string to the analyzer.
.
2-46
Examples
Using the Learn String
10 ! This program shows how to retrieve a learn string from the analyzer
20 ! into a string array. The state of the analyzer is then changed and the
30 ! learn string reloaded to return the analyzer to the previous settings.
40 !
50 ! EXAMP5A
60 !
70 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
80 !
90 CLEAR SCREEN
100 ! Initialize the analyzer
110 ABORT 7 ! Generate an IFC (Interface Clear)
120 CLEAR @Nwa ! SDC (Selected Device Clear)
130 !
140 DIM State$[3000] ! Define a string for contents
150 !
160 OUTPUT @Nwa;”OUTPLEAS;” ! Output the learn string
170 ENTER @Nwa USING “+,-K”;State$ ! Read the string with no processing
180 ! + Terminate on EOI only
190 ! -K ignore LF as terminator treat as data
200 !
210 LOCAL @Nwa ! Release HP-IB control
220 !
230 INPUT “Change state and press ENTER”,A$
240 !
250 OUTPUT @Nwa;”INPULEAS;”;State$; ! Send the learn string to analyzer
260 DISP “Analyzer state has been restored!”
270 !
280 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
290 ENTER @Nwa;Reply ! Read the 1 when complete
300 LOCAL @Nwa ! Release HP-IB control
310 END
2-47
Examples
Reading Calibration Data
Reading Calibration Data
File Name
Description
EXAMP5B.BAS
This example demonstrates:
• how to read measurement calibration data out of the analyzer
• how to read it back into the analyzer
• how to determine which calibration is active
The data used to perform measurement-error correction is stored inside the
analyzer in one (or more) of twelve calibration-coefficient arrays. Each array
is a specific error coefficient, and is stored and transmitted as an error-corrected data array. Each point is a real/imaginary pair, and the number of points
in the array is the same as the number of points in the trace. The five arraydata formats also apply to the transfer of calibration-coefficient arrays. "Printing, Plotting, or Saving Measurement Results" in the
contains information on the storage locations for calibration coefficients and
different calibration types.
A computer can read out the error coefficients using the commands
OUTPCALC01, OUTPCALC02
uses only as many arrays as required, beginning with array 1. Hence, it is necessary to know the type of calibration about to be read out. Attempting to read
an array not being used in the current calibration causes the
DATA NOT CURRENTLY AVAILABLE
A computer can also store calibration coefficients in the analyzer. To do this,
declare the type of calibration data about to be stored in the analyzer just as if
you were about to perform that calibration. Then, instead of calling up different classes, transfer the calibration coefficients using the
mands. The variables
representing a calibration number from
cients are stored in the analyzer, activate the calibration by issuing the mne-
SAVC
monic
;
, and trigger a sweep on the analyzer.
nn
, ... through,
are a data pair appended to the command
OUTPCALC12
warning.
01
through 12. When all the coeffi-
HP 8702D User’s Guide
. Each calibration type
REQUESTED
INPUCALC
nn;
com-
2-48
Examples
Reading Calibration Data
This example reads the calibration coefficients into a very large array, from
which they can be examined, modified, stored, or put back into the instrument. If the data is to be directly stored on to disk, it is usually more efficient
to use Form 1 (analyzer’s internal-binary format), and to store each coefficient
array as it is read in.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The calibration types and number of arrays are defined.
• The integer variables for reading the headers are defined.
• The calibration type and number of arrays are read by the controller.
• The output is formatted in Form 3.
• The number of points in the trace is read.
• The memory is allocated for the calibration arrays.
• Each calibration array is requested from the analyzer.
• The elements from each calibration array are read in.
• The next calibration array is requested until all the arrays have been read.
• The calibration type is sent to the analyzer.
• Each calibration array is sent.
• The calibration is activated.
• The analyzer is released from remote control and the program ends.
Running the Program
Before executing the program, perform a calibration.
The program is able to detect which type of calibration is active. With that
information, it predicts how many arrays to read out. When all the arrays have
been sent to the computer, the program prompts the operator. The operator
then switches OFF the calibration or performs a completely different calibration on the analyzer and continues the program. The computer reloads the old
calibration. The operator should not preset the analyzer because the instrument settings must be the same as those that were present when the calibration was taken.
NOTE
The retransmitted calibration is associated with the current instrument state; the instrument has no way of knowing the original state associated with the calibration data. For
this reason, it is recommended that the learn string be used to store the instrument state
whenever calibration data is stored. The next example demonstrates how to reload the
analyzer state with both the learn string and the calibration arrays.
2-49
Examples
Reading Calibration Data
10 ! This program shows how to manipulate calibration data from the analyzer.
20 ! It demonstrates how to read calibration data from the analyzer, and
30 ! how to replace it. The type of calibration active is determined and
40 ! the program reads in the correct number of arrays. The number of points
50 ! in the trace, and in the cal array, is determined and used to dimension
60 ! storage arrays.
70 !
80 ! EXAMP5B
90 !
100 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer
110 ASSIGN @Nwa_bin TO 716;FORMAT OFF ! Assign binary path
120 !
130 CLEAR SCREEN
140 ! Initialize the analyzer
150 ABORT 7 ! Generate an IFC (Interface Clear)
160 CLEAR @Nwa ! SDC (Selected Device Clear)
170 !
180 ! Data for determining CAL type and number of arrays
190 DATA “CALIRESP”,1,”CALIRAI”,2,”CALIS111”,3
200 DATA “CALIS221”,3,”CALIFUL2”,12
210 DATA “NOOP”,0
220 !
230 INTEGER Hdr,Lgth,I,J ! Integers for reading headers
240 !
250 READ Calt$,Numb ! Read CAL type from data statement
260 IF Numb=0 THEN GOTO 690 ! If no CAL type is present Exit
270 OUTPUT @Nwa;Calt$;”?;” ! Query if CAL type is active
280 ENTER @Nwa;Active ! Read 1 if active
290 IF NOT Active THEN GOTO 250 ! Load another CAL type and re-try
300 !
310 PRINT Calt$,Numb ! Active CAL and number of arrays
320 !
330 OUTPUT @Nwa;”FORM3;” ! Form 3 IEEE 64 bit floating point
340 OUTPUT @Nwa;”POIN?;” ! Request trace length
350 ENTER @Nwa;Poin ! Read number of points
360 ALLOCATE Cal(1:Numb,1:Poin,1:2) ! Arrays for CAL arrays
370 ! Number of arrays, number of points real and imag value per point
380 !
390 FOR I=1 TO Numb ! Read arrays
400 OUTPUT @Nwa USING “K,ZZ”;”OUTPCALC”,I ! Format I to add 0 in command
410 ENTER @Nwa_bin;Hdr,Lgth ! Read header & length from array
420 FOR J=1 TO Poin ! Read elements for CAL array
430 ENTER @Nwa_bin;Cal(I,J,1),Cal(I,J,2) ! Read real & imag pair elements
440 NEXT J ! Next location in array
450 NEXT I ! Next CAL array
460 !
470 ! All CAL arrays have been read
480 !
490 INPUT “PRESS RETURN TO RE-TRANSMIT CALIBRATION”,Dum$
500 !
510 OUTPUT @Nwa;”FORM3;” ! Use same format as read
520 OUTPUT @Nwa;Calt$;”;” ! Send CAL type to analyzer
530 !
540 FOR I=1 TO Numb ! Send each array in CAL
550 DISP “TRANSMITTING ARRAY: “,I ! Show array number
560 OUTPUT @Nwa USING “K,ZZ”;”INPUCALC”,I ! Send array number 0 format
2-50
Examples
Reading Calibration Data
570 OUTPUT @Nwa_bin;Hdr,Lgth ! Send header & array length
580 FOR J=1 TO Poin ! Send each array element
590 OUTPUT @Nwa_bin;Cal(I,J,1),Cal(I,J,2) ! Real and Imag pair
600 NEXT J ! Next element in array
610 NEXT I ! Next array
620 !
630 OUTPUT @Nwa;”SAVC;” ! Activate CAL
640 !
650 OUTPUT @Nwa;”CONT;” ! Restore continuous sweep
660 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for analyzer to finish
670 ENTER @Nwa;Reply ! Read the 1 when complete
680 !
690 DISP “Finished with CAL transfer”
700 LOCAL @Nwa ! Release HP-IB control
710 END
2-51
Examples
Using Instrument States
Using Instrument States
File Name
Description
EXAMP5C.BAS
NOTE
The instrument state may also be stored in the analyzer’s internal registers. This is the
fastest and most efficient method for toggling between instrument states. This example
is for use when the analyzer’s internal memory is full, or when there are other internalmemory limitations.
This example demonstrates using both the learn string and the calibration
arrays to completely re-program the analyzer state. If you were performing
two entirely different measurements on a device and wanted to quickly
change between instrument states and perform the measurements, this example program is a potential solution.
The example will request the learn string and a calibration array from the analyzer and store them in a disk file on the system controller. Once the storage is
complete, the operator will be prompted to change the state of the analyzer
and then reload the state that was previously stored in the disk file. Once the
file is created on the disk, the state information can be retrieved from the controller and restored on the analyzer.
NOTE
The disk file can only be created once. Errors will occur if the operator repeatedly tries to
recreate the file.
For this example, only a thru response calibration will be performed and
transferred. This means only one calibration array will be read from the analyzer and written to the disk file with the instrument state. To work with more
2-52
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.