The information contained in this document is subject to change
without notice.
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. Hewlett-Packard
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.
2
How to Use This Guide
This guide uses the following conventions:
Front-Panel KeyThis represents a key physically located on the
instrument.
SoftkeyThis represents a “softkey”, a key whose label is
determined by the instrument firmware.
Screen Text This represents text displayed on the instrument’s
screen.
3
HP 8753E/Option 011 Network Analyzer
Documentation Map
The Installation and Quick Start Guide
familiarizes you with the HP 8753E/Option 011
network analyzer’s front and rear panels,
electrical and environmental operating
requirements, as well as procedures for installing,
configuring, and verifying the operation of the
analyzer.
The User’s Guide show how to make
measurements, explains commonly-used features,
and tells you how to get the most performance
from your analyzer.
The Quick Reference Guide provides a
summary of selected user features.
The HP-IB Programming Examples Guide
provides a tutorial introduction using BASIC
programming examples to demonstrate the remote
operation of the network analyzer.
The HP BASIC Programming ExamplesGuide provides a tutorial introduction using
BASIC programming examples to demonstrate the
remote operation of the network analyzer.
The System Verification and Test Guide
provides the system verification and performance
test and the Performance Test Record for your HP
8753E/Option 011 network analyzer.
This is an introduction to the remote operation of the HP 8753E Network Analyzer using
an external controller. This is a tutorial introduction using BASIC programming examples
to demonstrate the remote operation of the network analyzer. The examples used in this
document are on the “HP 8753E HP BASIC Programming Examples” disk.
The user should be familiar with the operation of the analyzer before attempting to
remotely control the analyzer via the Hewlett-Packard Interface Bus (HP-IB). See the HP8753E Network Analyzer User's Guide for analyzer operating information.
The following computers operating with BASIC 6.2 can be used in these examples:
• HP 9000 Series 200/300
• HP 9000 Series 700 with HP BASIC-UX
This document is not intended to teach BASIC programming or to discuss HP-IB theory
except at an introductory level.
For more information concerning B ASIC , seeT able 1-1 for a list of manuals supporting the
BASIC revision being used. For more information concerning the Hewlett-Packard
Interface Bus, see Table 1-2.
Table 1-1 Additional BASIC 6.2 Programming Information
DescriptionHP Part Number
HP BASIC 6.2 Programming Guide
HP BASIC 6.2 Language Reference (2 Volumes)
Using HP BASIC for Instrument Control, Volume I
Using HP BASIC for Instrument Control, Volume II
Table 1-2 Additional HP-IB Information
DescriptionHP Part Number
HP BASIC 6.2 Interface Reference
Tutorial Description of the Hewlett-Packard Interface Bus
98616-90010
98616-90004
82303-90001
82303-90002
98616-90013
5021-1927
An IBM-compatible personal computer with an HP-IB/GPIB interface card may also be
used as an instrument controller. Hewlett-Packard provides a software package, HP
BASIC for Windows, that will execute the HP BASIC examples as described in this
document. Contact your local Hewlett-Packard sales office for further information on this
package.
Test device ......................................................................suc h as a 125 MHz bandpass filter
NOTEThe test device shipped with the instrument is a 10.24 GHz bandpass filter. If
you wish to use this device, the frequency ranges of the example programs
must be modified accordingly.
The computer must have enough memory to store:
• BASIC 6.2 (4 MBytes of memory is required)
• the required binaries
Upon receipt, make copies of the “Programming Examples” disks. Label them
“Programming Examples BACKUP”. These disks will act as reserves in the
event of loss or damage to the original disks.
Optional Equipment
See the “Compatible Peripherals” chapter in theHP 8753E Network Analyzer User's Guide
for complete information on the following optional equipment:
Calibration kits
Test port return cables
Plotter
Printer
Disk drive
System Setup and HP-IB Verification
This section describes how to:
• Connect the test system.
• Set the test system addresses.
• Set the network analyzer's control mode.
• Verify the operation of the system's interface bus (HP-IB).
Chapter 111
HP BASIC Programming Examples Guide
Introduction
Figure 1-1The HP 8753E Network Analyzer System with Controller
1. Connect the analyzer to the computer with an HP-IB cable as shown in Figure 1-1.
2. Switch on the computer.
3. Load the BASIC 6.2 operating system.
4. Switch on the analyzer.
a. To verify the analyzer's address, press:
Local, SET ADDRESSES, ADDRESS: 8753
The analyzer has only one HP-IB interface, though it occupies two addresses: one for
the instrument and one for the display. The display address is equal to the
instrument address with the least-significant bit incremented. The display address
is automatically set each time the instrument address is set.
The default analyzer addresses are:
• 16 for the instrument
• 17 for the display
CAUTIONOther devices connected to the bus cannot occupy the same address as
the analyzer.
The analyzer displays the instrument's address in the upper right section of the
display. If the address is not 16, return the address to its default setting (16) by
pressing:
16, x1, Preset
12Chapter 1
HP BASIC Programming Examples Guide
Introduction
b. Set the system control mode to either “pass-control” or “talker/listener” mode. These
are the only control modes in which the analyzer will accept commands over HP-IB.
For more information on control modes, see the HP-IB Programming and CommandReference Guide. To set the system-control mode, press:
Local, TALKER/LISTENER
or
Local, USE PASS CONTROL
5. Chec k the interface bus by performing a simple command from the computer controller.
Type the following command on the controller:
OUTPUT 716;”PRES;” Execute or Return
NOTEHP 9000 Series 300 computers use the Return key as both execute and
enter. Some other computers may have an
performs the same function. For reasons of simplicity, the notation
Enter, Execute, or Exec key that
Return
is used throughout this document.
This command should preset the analyzer. If an instrument preset does not occur , there
is a problem. Check all HP-IB addresses and connections. Most HP-IB problems are
caused by an incorrect address and faulty/loose HP-IB cables.
Chapter 113
HP BASIC Programming Examples Guide
HP 8753E Network Analyzer Instrument Control Using BASIC
HP 8753E Network Analyzer Instrument Control Using
BASIC
A remote controller can manipulate the functions of the analyzer by sending commands to
the analyzer via the Hewlett-Packard Interface Bus (HP-IB). The commands used are
specific to the analyzer. Remote commands executed over the bus take precedence over
manual commands executed from the instrument's front panel. Remote commands are
executed as soon as they are received by the analyzer. A command only applies to the
active channel (except in cases where functions are coupled between channels). Most
commands are equivalent to front-panel hardkeys and softkeys.
Command Structure in BASIC
Consider the BASIC command for setting the analyzer's start frequency to 50 MHz:
OUTPUT 716;”STAR 50 MHZ;”
The command structure in BASIC has several different elements:
the BASIC command statementOUTPUT - The BASIC data-output statement.
the appendage716 - The data is directed to interface 7 (HP-IB), and
on to the device at address 16 (the analyzer). This
appendage is terminated with a semicolon. The next
appendage is STAR, the instrument mnemonic for
setting the analyzer's start frequency.
data50 - a single operand used by the root mnemonic STAR
to set the value.
unitMHZ - the units that the operand is expressed in.
terminator; - indicates the end of a command, enters the data,
and deactivates the active-entry area.
The “STAR 50 MHZ;” command performs the same function as pressing the following
keys on the analyzer's front panel:
Start, 50, M/u
STAR is the root mnemonic for the start key, 50 is the data, and MHZ are the units. Where
possible, the analyzer's root mnemonics are derived from the equivalent key label.
Otherwise they are derived from the common name for the function. HP-IB Programmingand Command Reference Guide. lists all the root mnemonics and all the different units
accepted.
The semicolon (;) following MHZ terminates the command within the analyzer. It removes
start frequency from the active-entry area, and prepares the analyzer for the next
command. If there is a syntax error in a command, the analyzer will ignore the command
and look for the next terminator. When it finds the next terminator, it starts processing
14Chapter 1
HP BASIC Programming Examples Guide
HP 8753E Network Analyzer Instrument Control Using BASIC
incoming commands normally. Characters between the syntax error and the next
terminator are lost. A line feed also acts as a terminator. The BASIC OUTPUT statement
transmits a carriage return/line feed following the data. This can be suppressed by putting
a semicolon at the end of the statement.
The OUTPUT 716; statement will transmit all items listed (as long as they are separated
by commas or semicolons) including:
literal information enclosed in quotes,
numeric variables,
string variables,
and arrays.
A carriage return/line feed is transmitted after each item. Again, this can be suppressed by
terminating the commands with a semicolon. The analyzer automatically goes into remote
mode when it receives an OUTPUT command from the controller. When this happens, the
front-panel remote (R) and listen (L) HP-IB status indicators illuminate. In remote mode,
the analyzer ignores any data that is input with the front-panel keys, with the exception of
Local. Pressing Local returns the analyzer to manual operation, unless the universal HP-IB
command LOCAL LOCKOUT 7 has been issued. There are two ways to exit from a local
lockout. Either issue the LOCAL 7 command from the controller or cycle the line power on
the analyzer.
Setting a parameter such as start frequency is just one form of command the analyzer will
accept. It will also accept simple commands that require no operand at all. For example,
execute:
OUTPUT 716;"AUTO;"
In response, the analyzer autoscales the active channel. Autoscale only applies to the
active channel, unlike start frequency, which applies to both channels as long as the
channels are stimulus-coupled.
The analyzer will also accept commands that switch various functions ON and OFF. For
example, to switch on dual-channel display, execute:
OUTPUT 716;"DUACON;"
DUACON is the analyzer root mnemonic for “dual-channel display on.” This causes the
analyzer to display both channels. To go back to single-channel display mode, for example,
switching off dual-channel display, execute:
OUTPUT 716;"DUACOFF;"
The construction of the command starts with the root mnemonic DUAC (dual-channel
display) and ON or OFF is appended to the root to form the entire command.
The analyzer does not distinguish between upper- and lower-case letters. For example,
execute:
OUTPUT 716;"auto;"
Chapter 115
HP BASIC Programming Examples Guide
HP 8753E Network Analyzer Instrument Control Using BASIC
NOTEThe analyzer also has a debug mode to aid in troubleshooting systems. When
the debug mode is ON, the analyzer scrolls incoming HP-IB commands across
the display. To manually activate the debug mode, press
HP-IB DIAG ON
OUTPUT 716;"DEBUOFF;"
. To deactivate the debug mode from the controller, execute:
Local,
Command Query
Suppose the operator has changed the power level from the front panel. The computer can
find the new power level using the analyzer's command-query function. If a question mark
is appended to the root of a command, the analyzer will output the value of that function.
For instance, POWE 7 DB; sets the analyzer's output power to 7 dB, and POWE?; outputs
the current RF output power at the test port to the system controller. For example:
Type SCRATCH and press
Type EDIT and press
10 OUTPUT 716;"POWE?;"
20 ENTER 716;Reply
30 DISP Reply
40 END
Return to clear old programs.
Return to access the edit mode. Then type in:
Running the Program
The computer will display the preset source-power level in dBm. Change the power level
by pressing
When the analyzer receives POWE?, it prepares to transmit the current RF source-power
level. The BASIC statement ENTER 716 allows the analyzer to transmit information to the
computer by addressing the analyzer to talk. This illuminates the analyzer front-panel
talk (T) light. The computer places the data transmitted by the analyzer into the variables
listed in the ENTER statement. In this case, the analyzer transmits the output power,
which gets placed in the variable Reply.
The ENTER statement takes the stream of binary-data output from the analyzer and
reformats it back into numbers and ASCII strings. With the formatting set to its default
state, the ENTER statement will format the data into real variables, integers, or ASCII
strings, depending on the variable being filled. The variable list must match the data the
analyzer has to transmit. If there are not enough variables, data is lost. If there are too
many variables for the data available, a BASIC error is generated.
Local, Menu, POWER, XX, x1. Now run the program again.
The formatting done by the ENTER statement can be changed. For more information on
data formatting, see the HP-IB Programming and Command Reference Guide section
titled “ Array Data F ormats . ” The formatting can be deactivated to allow binary transfers of
data. Also, the ENTER USING statement can be used to selectively control the formatting.
ON/OFF commands can be also be queried. The reply is a one (1) if the function is active, a
zero (0) if it is not active. Similarly, if a command controls a function that is underlined on
the analyzer softkey menu when active, querying that command yields a one (1) if the
16Chapter 1
HP BASIC Programming Examples Guide
HP 8753E Network Analyzer Instrument Control Using BASIC
command is underlined, a zero (0) if it is not. For example, press Meas. Though there are
seven options on the measurement menu, only one is underlined at a time. The underlined
option will return a one (1) when queried.
For instance, rewrite line 10 as:
10OUTPUT 716;"DUAC?;"
Run the program once and note the result. Then press Local, Display, DUAL CHAN to toggle the
display mode, and run the program again.
Another example is to rewrite line 10 as:
10OUTPUT 716;"PHAS?;"
In this case, the program will display a one (1) if phase is currently being displayed. Since
the command only applies to the active channel, the response to the PHAS? inquiry
depends on which channel is active.
Operation Complete
Occasionally, there is a need to query the analyzer as to when certain analyzer operations
have completed. For instance, a program should not have the operator connect the next
calibration standard while the analyzer is still measuring the current one. T o provide such
information, the analyzer has an “operation complete” reporting mechanism, or OPC
command, that will indicate when certain key commands have completed operation. The
mechanism is activated by sending either OPC or OPC? immediately before an
OPC-compatible command. When the command completes execution, bit 0 of the
event-status register will be set. If OPC was queried with OPC?, the analyzer will also
output a one (1) when the command completes execution.
As an example, type SCRATCH and press
Type EDIT and press
Return.
Return.
Type in the following program:
10 OUTPUT 716;"SWET 3 S;OPC?;SING;"Set the sweep time to 3 seconds, and OPC a single sweep.
20 DISP "SWEEPING"
30 ENTER 716;ReplyThe program will halt at this point until the analyzer completes the
sweep and issues a one (1).
40 DISP "DONE"
50 END
Running the Program
Running this program causes the computer to display the sweeping message as the
instrument executes the sweep. The computer will display DONE just as the instrument
goes into hold. When DONE appears, the program could then continue on, being assured
that there is a valid data trace in the instrument.
Chapter 117
HP BASIC Programming Examples Guide
HP 8753E Network Analyzer Instrument Control Using BASIC
Preparing for Remote (HP-IB) Control
At the beginning of a program, the analyzer is taken from an unknown state and brought
under remote control. This is done with an abort/clear sequence. ABORT 7 is used to halt
bus activity and return control to the computer. CLEAR 716 will then prepare the analyzer
to receive commands by:
• clearing syntax errors
• clearing the input-command buffer
• clearing any messages waiting to be output
The abort/clear sequence readies the analyzer to receive HP-IB commands. The next step
involves programming a known state into the analyzer. The most convenient way to do this
is to preset the analyzer by sending the PRES (preset) command. If preset cannot be used,
the status-reporting mechanism may be employed. When using the status-reporting
register, CLES (Clear Status) can be transmitted to the analyzer to clear all of the
status-reporting registers and their enables.
Type SCRATCH and press
Type EDIT and press
10 ABORT 7This halts all bus action and gives active control to
20 CLEAR 716This clears all HP-IB errors, resets the HP-IB interface, and clears
30 OUTPUT 716;"PRES;"Presets the instrument. This clears the status-reporting system, as
40 ENDRunning this program brings the analyzer to a known state, ready to
Return.
Return. Type in the following program:
the computer.
the syntax errors. It does not affect the status-reporting system.
well as resets all of the front-panel settings, except for the HP-IB
mode and the HP-IB addresses.
respond to HP-IB control.
The analyzer will not respond to HP-IB commands unless the remote line is asserted.
When the remote line is asserted, the analyzer is addressed to listen for commands from
the controller. In remote mode, all the front-panel keys are disabled (with the exception of
Local and the line-power switch). ABORT 7 asserts the remote line, which remains asserted
until a LOCAL 7 statement is executed.
Another way to assert the remote line is to execute:
REMOTE 716
This statement asserts the analyzer's remote-operation mode and addresses the analyzer
to listen for commands from the controller. Press any front-panel key except
that none of the front-panel keys will respond until
Local can also be disabled with the sequence:
REMOTE 716
LOCAL LOCKOUT 7
18Chapter 1
Local has been pressed.
Local. Note
HP BASIC Programming Examples Guide
HP 8753E Network Analyzer Instrument Control Using BASIC
After executing the code above, none of front-panel keys will respond. The analyzer can be
returned to local mode temporarily with:
LOCAL 716
As soon as the analyzer is addressed to listen, it goes back into local-lockout mode. The
only way to clear the local-lockout mode, aside from cycling line power, is to execute:
LOCAL 7
This command un-asserts the remote line on the interface. This puts the instrument into
local mode and clears the local-lockout command. Return the instrument to remote mode
by pressing:
Local, TALKER/LISTENER
or
Local, USE PASS CONTROL
I/O Paths
One of the features of HP BASIC is the use of input/output paths. The instrument may be
addressed directly by the instrument's device number as shown in the previous examples.
However, a more sophisticated approach is to declare I/O paths such as: ASSIGN @Nwa TO
716. Assigning an I/O path builds a look-up table in the computer's memory that contains
the device-address codes and several other parameters. It is easy to quickly change
addresses throughout the entire program at one location. I/O operation is more efficient
because it uses a table, in place of calculating or searching for values related to I/O. In the
more elaborate examples where file I/O is discussed, the look-up table contains all the
information about the file. Execution time is decreased, because the computer no longer
has to calculate a device's address each time that device is addressed.
For example:
Type SCRATCH and press
Type EDIT and press
Return.
Return.
Type in the following program:
10 ASSIGN @Nwa TO 716Assigns the analyzer to ADDRESS 716.
20 OUTPUT @Nwa;"STAR 50 MHZ;" Sets the analyzer's start frequency to 50 MHz.
NOTEThe use of I/O paths in binary-format transfers allows the user to
quickly distinguish the type of transfer taking place. I/O paths are used
throughout the examples and are highly recommended for use in device
input/output.
Chapter 119
HP BASIC Programming Examples Guide
Measurement Process
Measurement Process
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:
• the sweep type
• the frequency span
• the sweep time
• the number of points (in the data trace)
• the RF power level
• the type of measurement
• the IF averaging
• the 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. See “Example 5A: Using
the Learn String.”
Step 2. Calibrating the Test Setup
After you have defined an instrument state, you should perform a measurement
calibration. Although it is not required, a measurement calibration improves the accuracy
of your measurement data.
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:
❏ “Example 2A: S
20Chapter 1
1-Port Measurement Calibration.”
11
HP BASIC Programming Examples Guide
Measurement Process
❏ “Example 2B: Full 2-Port Measurement Calibration.”
❏ “Example 2C: Adapter Removal Calibration.”
❏ “Example 2D: Using Raw Data to Create a Calibration (Simmcal).”
❏ “Example 2E: Take4 — Error Correction Processed on an External PC.”
• Transfer the calibration data from a previous calibration back into the analyzer, as
discussed in “Example 5C: Saving and Restoring the Analyzer Instrument State.”
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 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.
Step 5. Post-Processing the Measurement Data
The HP 8753E Network Analyzer HPIB Programming and Command Reference Guide
figure titled “The Data Processing Chain For Measurement Outputs” 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-dela y 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 to insure
that the data transmitted reflects the current state of the instrument.
Chapter 121
HP BASIC Programming Examples Guide
BASIC Programming Examples
BASIC Programming Examples
The following sample programs provide the user with factory-tested solutions for several
remotely-controlled analyzer processes. The programs can be used in their present state or
modified to suit specific needs. The programs discussed in this section can be found on the
“HP 8753E HP BASIC Programming Examples” disk received with the analyzer.
• Example 1: Measurement Setup
❏ Example 1A: Setting Parameters
❏ Example 1B: Verifying Parameters
• Example 2: Measurement Calibration
❏ Example 2A: S
1-Port Measurement Calibration
11
❏ Example 2B: Full 2-Port Measurement Calibration
❏ Example 2C: Adapter Removal Calibration
❏ Example 2D: Using Raw Data to Create a Calibration (Simmcal)
❏ Example 2E: Take4 — Error Correction Processed on an External PC
• Example 3: Measurement Data Transfer
❏ Example 3A: Data Transfer Using Markers
❏ Example 3B: Data Transfer Using FORM 4 (ASCII Transfer)
❏ Example 3C: Data Transfer Using Floating-Point Numbers
❏ Example 3D: Data Transfer Using Frequency−Array Information
❏ Example 3E: Data Transfer Using FORM 1 (Internal Binary Format)
• Example 4: Measurement Process Synchronization
❏ Example 4A: Using the Error Queue
❏ Example 4B: Generating Interrupts
❏ Example 4C: Power Meter Calibration
• Example 5: Network Analyzer System Setups
❏ Example 5A: Using the Learn String
❏ Example 5B: Reading Calibration Data
❏ Example 5C: Saving and Restoring the Analyzer Instrument State
• Example 6: Limit-Line Testing
❏ Example 6A1: Setting Up a List-Frequency Table In Stepped List Mode
❏ Example 6A2: Setting Up a List-Frequency Table In Swept List Mode
22Chapter 1
HP BASIC Programming Examples Guide
BASIC Programming Examples
❏ Example 6B: Selecting a Single Segment from a Table of Segments
❏ Example 6C: Setting Up a Limit Test Table
❏ Example 6D: Performing PASS/FAIL Tests While Tuning
• Example 7: Report Generation
❏ Example 7A1: Operation Using Talker/Listener Mode
❏ Example 7A2: Controlling Peripherals Using Pass-Control Mode
❏ Example 7A3: Printing with the Serial Port
❏ Example 7B1: Plotting to a File and Transferring the File Data to a Plotter
• Utilizing PC-Graphics Applications Using the Plot File
❏ Example 7B2: Reading Plot Files From a Disk
❏ Example 7C: Reading ASCII Disk Files to the Instrument Controller's Disk File
• Example 8: Mixer Measurements
❏ Example 8A: Comparison of Two Mixers — Group Delay, Amplitude or Phase
Program Information
The following information is provided for every example program included on the
“Programming Examples” disk:
• A program description
• An outline of the program's processing sequence
• A step-by-step instrument-command-level tutorial explanation of the program
including:
❏ The command mnemonic and command name for the HP-IB instrument command
used in the program.
❏ An explanation of the operations and affects of the HP-IB instrument commands
used in the program.
Analyzer Features Helpful in Developing Programming
Routines
Analyzer-Debug Mode
The analyzer-debug mode aids you in developing programming routines. The analyzer
displays the commands being received. If a syntax error occurs, the analyzer displays the
last buffer and points to the first character in the command line that it could not
understand.
Chapter 123
HP BASIC Programming Examples Guide
BASIC Programming Examples
You can enable this mode from the front panel by pressing Local, HP-IB DIAG ON. The debug
mode remains activated until you preset the analyzer or deactivate the mode. You can also
enable this mode over the HP-IB using the DEBUON; command and disable the debug mode
using the DEBUOFF; command.
User-Controllable Sweep
There are three important advantages to using the single-sweep mode:
1. The user can initiate the sweep.
2. The user can determine when the sweep has completed.
3. The user can be confident that the trace data has be derived from a valid sweep.
Execute the command string OPC?;SING; to place the analyzer in single-sweep mode and
trigger a sweep. Once the sweep is complete, the analyzer returns an ASCII character one
(1) to indicate the completion of the sweep.
NOTEThe measurement cycle and the data acquisition cycle must always be
synchronized. The analyzer must complete a measurement sweep for
the data to be valid.
24Chapter 1
HP BASIC Programming Examples Guide
Example 1: Measurement Setup
Example 1: Measurement Setup
The programs included in Example 1 provide the user the option to perform
instrument-setup functions for the analyzer from a remote controller. Example 1A is a
program designed to setup the analyzer's measurement parameters. Example 1B is a
program designed to verify the measurement parameters.
Example 1A: Setting Parameters
NOTEThis program is stored as EXAMP1A on the “Programming Examples” disk
received with the network analyzer.
In general, the procedure for setting up measurements on the network analyzer via HP-IB
follows the same sequence as if the setup was performed manually. There is no required
order, as long as the desired frequency range, number of points, and power level are set
prior to performing the calibration first, and the measurement second.
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 an outline of the program's processing sequence:
• An I/O path is assigned for the analyzer.
• The system is initialized.
• The analyzer is adjusted to measure return loss (S
) on channel 1 and display it in log
11
magnitude.
• The analyzer is adjusted to measure return loss (S11) 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.
The program is written as follows:
10! This program performs some example queries of network 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!
70ASSIGN @Nwa TO 716! Assign an I/O path for the analyzer
80!
Chapter 125
HP BASIC Programming Examples Guide
Example 1: Measurement Setup
90CLEAR 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 network 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
310PRINT "Averaging ON"
320 ELSE
330PRINT "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
Running the Program
The analyzer is initialized and the operator is queried for the measurement's start and
stop frequencies. The analyzer is setup to display the S
reflection measurement as a
11
function of log magnitude and phase over the selected frequency range. The displays are
autoscaled and the program ends.
Example 1B: Verifying Parameters
NOTEThis program is stored as EXAMP1B on the “Programming Examples” disk
received with the network analyzer.
This example shows how to read analyzer settings into your controller. HP-IBProgramming and Command Reference Guide contains additional information on the
command formats and operations. Appending a “?” to a command that sets an analyzer
parameter will return the value of that setting. Parameters that are set as ON or OFF
when queried will return a zero (0) if OFF or a one (1) if active. Parameters are returned in
ASCII format, FORM 4. This format is varying in length from 1 to 24 characters-per-value.
In the case of marker or other multiple responses, the values are separated by commas.
The following is an outline of the program's processing sequence:
• An I/O path is assigned for the analyzer.
• The system is initialized.
• The number of points in the trace is queried and dumped to a printer.
• The start frequency is queried and output to a printer.
• The averaging is queried and output to a printer.
26Chapter 1
HP BASIC Programming Examples Guide
Example 1: Measurement Setup
• The analyzer is released from remote control and the program ends.
The program is written as follows:
10! This program performs some example queries of network 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!
70ASSIGN @Nwa TO 716! Assign an I/O path for the analyzer
80!
90CLEAR 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 network 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
310PRINT "Averaging ON"
320 ELSE
330PRINT "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
Running the Program
The analyzer is preset. The preset values are returned and printed out 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.
Chapter 127
HP BASIC Programming Examples Guide
Example 2: Measurement Calibration
Example 2: Measurement Calibration
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 2-port
calibrations, which are divided into three calibration sub-sequences. The following
examples are included:
• Example 2A is a program designed to perform an S11 1-port measurement calibration.
• Example 2B is a program designed to perform a full 2-port measurement calibration.
• Example 2C is a program designed to accurately measure a “non-insertable” 2-port
device, using adapter removal.
• Example 2D is a program designed to use raw data to create a calibration, sometimes
called Simmcal.
• Example 2E is a program designed to offload the calculation of the 2-port error
corrected data to an external computer.
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. ” F or
example, measuring the short during an S
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 the 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
selecting
SHORT automatically measures the short because the class contains only one
1-port measurement calibration using a 7- or 3.5-mm calibration kit,
11
standard. When doing the same calibration in type-N, selecting
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. Once the standard has been selected and measured, the
must be pressed to exit the class.
1-port measurement calibration is one
11
SHORT brings up a second
DONE key
Doing an S11 1-port measurement calibration over HP-IB is very similar. When using a 7or 3.5-mm calibration kit, sending CLASS11B will automatically measure the short. In
type-N, sending CLASS11B brings up the menu with the male and female short options . T o
28Chapter 1
HP BASIC Programming Examples Guide
Example 2: Measurement Calibration
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. DONE; must be sent to exit the class.
Example 2A: S11 1-Port Calibration
NOTEThis program is stored as EXAMP2A on the “Programming Examples”
disk received with the network analyzer.
The following program performs an S
1-port calibration, using either the HP 85031B
11
7-mm calibration kit or the HP 85033D 3.5-mm calibration kit. If you wish to use adifferent calibration kit, modify the example program accordingly. This program simplifies
the calibration by providing explicit directions on the analyzer display while allowing the
user to run the program from the controller keyboard. More information on selecting
calibration standards can be found in the Optimizing Measurement Results chapter of the
HP 8753E/Option 011 Network Analyzer User's Guide.
The following is an outline of the program's processing sequence:
• An I/O path is assigned for the analyzer.
• The system is initialized.
• The appropriate calibration kit is selected.
• The softkey menu is deactivated.
• The S
• The S
-calibration sequence is run.
11
-calibration data is saved.
11
• The softkey menu is activated.
• The analyzer is released from remote control and the program ends.
The program is written as follows:
1 ! This program guides the operator through a 1-port calibration.
2 ! The operator must choose either the HP 85031B 7 mm calibration kit
3 ! or the HP 85033D 3.5 mm calibration kit.
4 ! The routine Waitforkey displays a message on the instrument’s
5 ! display and the console, to prompt the operator to connect the
6 ! calibration standard. Once the standard is connected, the
7 ! ENTER key on the computer keyboard is pressed to continue.
8 !
9 ! EXAMP2A
10 !
11 ASSIGN @Nwa TO 716! Assign an I/O path for the analyzer
12 !
13 CLEAR SCREEN
14 ! Initialize the system
15 ABORT 7 ! Generate an IFC (Interface Clear)
16 CLEAR @Nwa ! SDC (Selected Device Clear)
17 ! Select CAL kit type
18 INPUT “Enter a 1 to use the HP 85031B kit, 2 to use the HP 85033D kit”,Kit
19 IF Kit=1 THEN
Chapter 129
HP BASIC Programming Examples Guide
Example 2: Measurement Calibration
20 OUTPUT @Nwa;”CALK7MM;”
21 ELSE
22 OUTPUT @Nwa;”CALK35MD;”
23 END IF
24 !
25 OUTPUT @Nwa;”MENUOFF;” ! Turn softkey menu off.
26 !
27 OUTPUT @Nwa;”CALIS111;” ! S11 1 port CAL initiated
28 !
29 CALL Waitforkey(“CONNECT OPEN AT PORT 1”)
30 OUTPUT @Nwa;”OPC?;CLASS11A;” ! Open reflection CAL
31 ENTER @Nwa;Reply ! Read in the 1 returned
32 OUTPUT @Nwa;”DONE;” ! Finished with class standards
33 !
34 CALL Waitforkey(“CONNECT SHORT AT PORT 1”)
35 OUTPUT @Nwa;”OPC?;CLASS11B;” ! Short reflection CAL
36 ENTER @Nwa;Reply ! Read in the 1 returned
37 OUTPUT @Nwa;”DONE;” ! Finished with class standards
38 !
39 CALL Waitforkey(“CONNECT LOAD AT PORT 1”)
40 IF Kit=1 THEN ! Reflection load CAL
41 OUTPUT @Nwa;”OPC?;CLASS11C;”
42 ELSE
43 OUTPUT @Nwa;”CLASS11C;”
44 OUTPUT @Nwa;”OPC?;STANA;”
45 END IF
46 !
47 ENTER @Nwa;Reply ! Read in the 1 returned
48 !
49 OUTPUT 717;”PG;” ! Clear the analyzer display
50 !
51 DISP “COMPUTING CALIBRATION COEFFICIENTS”
52 !
53 OUTPUT @Nwa;”OPC?;SAV1;” ! Save the ONE PORT CAL
54 ENTER @Nwa;Reply ! Read in the 1 returned
55 !
56 DISP “S11 1-PORT CAL COMPLETED. CONNECT TEST DEVICE.”
57 OUTPUT @Nwa;”MENUON;” ! Turn on the softkey menu
58 !
59 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish
60 ENTER @Nwa;Reply ! Read the 1 when complete
61 LOCAL @Nwa ! Release HP-IB control
62 !
63 END
64 !
65 ! **************************** Subroutines ******************************
66 !
67 Waitforkey: ! Prompt routine to read a keypress on the controller
68 SUB Waitforkey(Lab$)
69 ! Position and display text on the analyzer display
70 OUTPUT 717;”PG;PU;PA390,3700;PD;LB”;Lab$;”, PRESS ENTER WHEN READY;”&CHR$(3)
71 !
72 DISP Lab$&” Press ENTER when ready”; ! Display prompt on console
73 INPUT A$ ! Read ENTER key press
74 !
75 OUTPUT 717;”PG;” ! Clear analyzer display
76 SUBEND
Running the Program
NOTEThis program does not modify the instrument state in any way. Before
running the program, set up the desired instrument state.
The program assumes that the test ports have either a 7-mm or 3.5-mm interface or an
adapter set using either a 7-mm or 3.5-mm interface. The prompts appear just above the
message line on the analyzer display. Pressing
the program and measures the standard. The program will display a message when the
measurement calibration is complete.
30Chapter 1
Enter on the controller keyboard continues
Loading...
+ 105 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.