Agilent 8702E Programmer’s Guide

Agilent 8702E Lightwave Component Analyzer Programmer’s Guide
© Copyright Agilent Technologies 2001 All Rights Reserved. Repro­duction, adaptation, or trans­lation without prior written permission is prohibited, except as allowed under copy­right laws.
Agilent Part No. 08702-91029 Printed in USA March 2001
Agilent Technologies Lightwave Division 3910 Brickway Boulevard­Santa Rosa, CA 95403, USA
Notice.
The information contained in this document is subject to change without notice. Com­panies, names, and data used in examples herein are ficti­tious unless otherwise noted. Agilent Technologies makes no warranty of any kind with regard to this material, includ­ing but not limited to, the implied warranties of mer­chantability and fitness for a particular purpose. Agilent Technologies shall not be lia­ble for errors contained herein or for incidental or conse­quential damages in connec­tion with the furnishing, performance, or use of this material.
Restricted Rights Legend.
Use, duplication, or disclo­sure 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 sub­paragraphs (c) (1) and (c) (2) of the Commercial Computer Software Restricted Rights clause at FAR 52.227-19 for other agencies.
Warranty.
This Agilent Technologies instrument product is war­ranted against defects in material and workmanship for a period of one year from date of shipment. During the war­ranty period, Agilent Technol­ogies will, at its option, either repair or replace products which prove to be defective. For warranty service or repair, this product must be returned to a service facility desig­nated by Agilent Technolo­gies. Buyer shall prepay shipping charges to Agilent Technologies and Agilent Technologies shall pay ship­ping charges to return the product to Buyer. However, Buyer shall pay all shipping charges, duties, and taxes for products returned to Agilent Technologies from another country.
Agilent Technologies war­rants that its software and firmware designated by Agi­lent Technologies for use with an instrument will execute its programming instructions when properly installed on that instrument. Agilent Tech­nologies does not warrant that the operation of the instru­ment, or software, or firmware will be uninterrupted or error­free.
Limitation of Warranty.
The foregoing warranty shall not apply to defects resulting from improper or inadequate maintenance by Buyer, Buyer­supplied software or interfac­ing, unauthorized modifica­tion or misuse, operation outside of the environmental specifications for the product, or improper site preparation or maintenance.
No other warranty is expressed or implied. Agilent Technologies specifically dis­claims the implied warranties of merchantability and fitness for a particular purpose.
Exclusive Remedies.
The remedies provided herein are buyer's sole and exclusive remedies. Agilent Technolo­gies shall not be liable for any direct, indirect, special, inci­dental, or consequential dam­ages, whether based on contract, tort, or any other legal theory.
Safety Symbols.
CAUTION
The
caution
sign denotes a hazard. It calls attention to a procedure which, if not cor­rectly performed or adhered to, could result in damage to or destruction of the product. Do not proceed beyond a cau­tion sign until the indicated conditions are fully under­stood and met.
WAR NI NG
The
warning
sign denotes a hazard. It calls attention to a procedure which, if not cor­rectly 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 man­ual symbol. The prod­uct 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 posi­tions of the instrument power line switch.
The OFF symbols
are used to mark the positions of the instru­ment power line switch.
The CE mark is a reg­istered trademark of the European Commu­nity.
The CSA mark is a reg­istered trademark of the Canadian Stan­dards Association.
The C-Tick mark is a registered trademark of the Australian Spec­trum Management Agency.
This text denotes the
ISM1-A
instrument is an Industrial Scientific and Medical Group 1 Class A product.
Typographical Conven­tions.
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 instru­ment’s screen.
Display type
for words or characters displayed on the computer’s screen or instru­ment’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

Contents

1 Writing Programs

General Information 1-3 Selecting the GPIB Device Mode 1-7 Making Measurements 1-9 Reading Data 1-11 Data-Processing Chain 1-18 Controlling Command Execution 1-22 Calibrating for Measurements 1-24 Debugging Programs 1-27 Understanding File Names 1-28 Drawing Graphics on the Display 1-29 Monitoring the Instrument 1-31 Response to IEEE-488 Universal Commands 1-37

2 Programming Examples

Preparing Measurement Settings 2-4 Verifying Measurement Settings 2-6 S11 1-Port Measurement Calibration 2-8 Full 2-Port Measurement Calibration 2-12 Data Transfer Using Markers 2-16 Data Transfer Using ASCII Format 2-20 Data Transfer Using Floating-Point Numbers 2-23 Data Transfer Using Frequency-Array Information 2-25 Data Transfer Using Internal Binary Format 2-28 Using Error Queue 2-30 Generating Interrupts 2-33 Power Meter Calibration 2-37 Using the Learn String 2-41 Reading Calibration Data 2-44 Using Instrument States 2-48 Setting a List Frequency Sweep 2-52 Selecting a Single Segment 2-56 Setting up Limit Lines 2-59 Performing Pass/Fail Tests 2-62 Operation Using Talker/Listener Mode 2-66 Controlling Peripherals 2-69 Printing Via the Serial Port 2-73
Contents-1
Contents
Plotting Data 2-75 Reading Plot Files from Disk 2-78 Reading ASCII Instrument Files 2-86

3 Language Reference

4 Graphics Language Reference

5 Tables and Charts

GPIB Requirements 5-2 Programming Commands by Functional Group 5-6 Key Definitions 5-20
Contents-2
1
General Information 1-3
To select the communication mode 1-6 To change the GPIB address 1-6
Selecting the GPIB Device Mode 1-7
To change the GPIB device mode 1-8 Making Measurements 1-9 Reading Data 1-11 Data-Processing Chain 1-18 Controlling Command Execution 1-22 Calibrating for Measurements 1-24
To calibrate the instrument 1-24 Debugging Programs 1-27
To start debugging mode 1-27 Understanding File Names 1-28 Drawing Graphics on the Display 1-29 Monitoring the Instrument 1-31 Response to IEEE-488 Universal Commands 1-37

Writing Programs

Writing Programs
Writing Programs
Writing Programs
This chapter provides a general introduction to programming the Agilent 8702E. 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 you 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-20 to locate the equivalent programming command.
NOTE:
Agilent 8702E User’s Guide
. Once
The Agilent 8702E conforms to IEEE 488.2 and IEC-625 standards for interfacing instru­ments.
1-2
Writing Programs

General Information

General Information
The Agilent 8702E occupies two GPIB 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-29. These addresses are stored in short-term, non-volatile memory and are not affected when you press Agilent 8702E is 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 Agilent 8702E is being used in pass-control mode. This is the address that control is passed back to when the Agilent 8702E-controlled operation is complete.
You can change the GPIB address from the front panel as described in “To
change the GPIB address” on page 1-6.
PRESET
or cycle the power. The default address for the
GPIB status lights
When the Agilent 8702E is connected to the GPIB, the front-panel GPIB status lights indicate the current status of the Agilent 8702E. These lights have the following definitions:
R = Remote operation
L = Listen mode
T = Talk mode
S = Service request (SRQ) asserted by the Agilent 8702E
Remote mode and front-panel lockout
Whenever the instrument is controlled by a computer, the front-panel GPIB remote status light, R, is turned on and the instrument keys are disabled. Press
LOCAL
the
Consult the documentation for your programming environment to determine which commands are used to put an instrument in the remote and local lock­out modes. These are not Agilent 8702E commands; they control GPIB control lines and do not send any characters to the Agilent 8702E.
key to restore front panel control of the instrument.
1-3
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 pro­gramming 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 GPIB address. Pressing the
PRE-
defined preset state.
Rules for writing commands
The Agilent 8702E accepts letters, changing lowercase to uppercase, num­bers, 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 argu­ment. If the analyzer does not recognize a character as appropriate, it gener­ates 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 exam­ple, MARK2 1.4GHZ.
Units and terminators
The Agilent 8702E 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 low­ercase letters are acceptable.
Table 1-1. Terminator Codes
S Seconds HZ Hertz
MS Milliseconds KHZ Kilohertz
US Microseconds MHZ Megahertz
1-4
Writing Programs
General Information
Table 1-1. Terminator Codes
NS Nanoseconds GHZ Gigahertz
PS Picoseconds DB dB or dBm
FS Femtoseconds V Volts
Terminators are used to indicate the end of a command. This allows the Agilent 8702E to execute the next command in the event of a syntax error. The semicolon (;) is the recommended command terminator. The line-feed character (LF) and the GPIB EOI line can also be used as terminators. Again, the Agilent 8702E will ignore the carriage-return character (CR).
.
Table 1-2. GPIB Interface Capabilities
Capability Description
SH1 Full-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.
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-5
Writing Programs
General Information
To select the communication mode
1
Press the
2
Press
LOCAL
key.
TALK ER/ LISTE NER
so that this softkey is underlined.
To change the GPIB address
1
Press the
2
Press
3
Press
4
Use the front-panel knob or keys to enter the new GPIB address.
LOCAL
key.
SET ADDRESSES.
ADDRESS: 8702
.
1-6
Writing Programs

Selecting the GPIB Device Mode

Selecting the GPIB Device Mode
Three different device modes are possible for the Agilent 8702E:
• 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.
Talker/listener mode
This is the mode that is normally used for remote programming of the Agilent 8702E. In talker/listener mode, the Agilent 8702E and all peripheral devices are controlled from an external instrument controller. The controller can command the Agilent 8702E to talk and other devices to listen. The Agilent 8702E and peripheral devices cannot talk directly to each other unless the computer sets up a data path between them. This mode allows the Agilent 8702E to act as either a talker or a listener, as required by the control­ling computer for the particular operation in progress.
While in this mode, the Agilent 8702E can make a plot or print using the
PPLOT;
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 Agilent 8702E will wait until it is
PRINALL;
and
require control to be passed to another
OUT-
System-controller mode
Do not attempt to use this mode for programming. This mode allows the Agilent 8702E to control peripherals directly in a standalone environment (without an external controller). This mode can only be selected manually from the Agilent 8702E’s front panel. It can only be used if no active computer or instrument controller is connected to the system via GPIB. If an attempt is made to set the Agilent 8702E to the system-controller mode when another
1-7
Writing Programs
Selecting the GPIB Device Mode
controller is connected to the interface, the following message is displayed on the Agilent 8702E’s display screen:
TROLLER ON GPIB"
The Agilent 8702E must be set to the system-controller mode in order to access peripherals from the front panel. In this mode, the Agilent 8702E can directly control peripherals (for example, plotters, printers, disk drives, and power meters) and the Agilent 8702E may plot, print, store on disk, or per­form power meter functions.
Pass control mode
This mode allows the computer to control the Agilent 8702E via GPIB (as with the talker/listener mode), but also allows the Agilent 8702E to take control of the interface in order to plot, print, or access a disk. During an Agilent 8702E­controlled peripheral operation, the host computer is free to perform other internal tasks (for example, data or display manipulation) while the Agilent 8702E is controlling the bus. After the Agilent 8702E-controlled task is completed, the Agilent 8702E returns control to the system controller.
In pass control mode, the Agilent 8702E can request control from the system controller and take control of the bus if the controller addresses it to take con­trol. This allows the Agilent 8702E to take control of printers, plotters, and disk drives on an as-needed basis. The Agilent 8702E sets event status regis­ter bit 1 when it needs control of the interface, and the Agilent 8702E will transfer control back to the system controller at the completion of the opera­tion. It will pass control back to its controller address specified by ADDR­CONT.
.
"CAUTION: ANOTHER SYSTEM CON-
To change the GPIB device mode
1
Press the
2
Press
1-8
LOCAL
key.
SET ADDRESSES.
Writing Programs

Making Measurements

Making Measurements
This section explains how to organize instrument commands into a measure­ment 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
• averaging
• IF bandwidth You can quickly set up an entire instrument state, using the save/recall regis­ters 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 ana­lyzer. Refer to “Using the Learn String” on page 2-41.
Step 2. Calibrating the test setup
After you have defined an instrument state, you should perform a measure­ment calibration. Although not required, measurement calibration improves accuracy.
1-9
Writing Programs
Making 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 1-
Port Measurement Calibration” on page 2-8 and “Full 2-Port Measurement Cal­ibration” on page 2-12.
• Transfer the calibration data from a previous calibration back into the analyzer, as discussed in “Using Instrument States” on page 2-48.
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 cap­tures the data on the analyzer display.
By using the single-sweep command (SING), you can ensure a valid sweep. When you use this command, the analyzer completes all stimulus changes before starting the sweep and does not release the GPIB 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 com­pleted.
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.
Step 5. Post-processing the measurement data
Figure 1-1 on page 1-19 shows the process functions used to affect the data
after you have made an error-corrected measurement. These process func­tions 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 to ensure that the data transmitted reflects the current state of the instru­ment.
1-10
Writing Programs

Reading Data

Reading Data
Output queue
Whenever an output-data command is received, the Agilent 8702E puts the data into the output queue (or buffer) where it is held until the system con­troller 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 Agilent 8702E.
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 charac­ter (?) to the command to interrogate the state of the functions. Suppose the operator has changed the power level from the Agilent 8702E’s front panel. The computer can ascertain the new power level using the Agilent 8702E’s command-interrogate function. If a question mark is appended to the root of a command, the Agilent 8702E will output the value of that function. For instance, the current RF source power at the test port. When the Agilent 8702E receives This condition illuminates the Agilent 8702E front-panel talk light (T). In this case, the Agilent 8702E 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 Agilent 8702E 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 to the Agilent 8702E. If dual-channel display is switched ON, the Agilent 8702E will return a one (1) to the instrument controller.
POWE 7 DB;
POWE?;
, it prepares to transmit the current RF source power level.
sets the source power to 7 dB, and
POWE?;
outputs
DUAC?;
1-11
Writing Programs
Reading Data
Similarly, to determine if phase is being measured and displayed, send the command string
PHAS?;
to the Agilent 8702E. In this case, the Agilent 8702E 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 Agilent 8702E 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 digits Digits to the left of the decimal point.
Decimal point
15 digits Digits to the right of the decimal point.
E Exponent notation.
Sign – for negative, + (or blank) for positive.
Exponent Two digits for the exponent.
* The items in this column are separated by commas and delimited (terminated) with a line feed character (LF).
1-12
Writing Programs
Reading Data
Marker data
The Agilent 8702E offers several options for outputting trace-related data. Trace information can be read out of the Agilent 8702E 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 trace­data 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 inter­polated 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 Agilent 8702E can be programmed to choose the stimu­lus value by using the value, or bandwidth search can be automatically determined with
SEARCH
. To continually update the search, switch the marker tracking ON. The
MARKER SEARCH
function. Maximum, minimum, target
MARKER
trace-maximum 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 Agilent 8702E. This set of commands causes the Agilent 8702E 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-13 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
Table 1-4. Units as a Function of Display Format
OUTPMARK OUTPFORM Marker Readout
Display Format Marker Mode
LOG MAG dB dB dB PHASE degrees degrees
Value 1 Value 2 Value 1 Value 2 Value
degrees
AUX Value
1-13
Writing Programs
Reading Data
Table 1-4. Units as a Function of Display Format
OUTPMARK OUTPFORM Marker Readout
Display Format Marker Mode
DELAY seconds seconds † SMITH CHART LIN MKR lin mag degrees real imag lin mag degrees
LOG MKR dB degrees real imag dB degrees Re/Im real imag real imag real imag R + jX real ohms imag ohms real imag real ohms imag ohms G + jB real
POLAR LIN MKR lin mag degrees real imag lin mag degrees
LOG MKR dB degrees real imag dB degrees
Re/Im real imag real imag real imag LIN MAG lin 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.
Value 1 Value 2 Value 1 Value 2 Value
seconds
Siemens
Siemens
imag Siemens
real imag real
AUX Value
imag Siemens
Array-data formats
The Agilent 8702E can transmit and receive arrays in the Agilent 8702E’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, output marker values, or non­array transfers such as queries. A transmitted array will be output in the cur­rent format, and the Agilent 8702E will attempt to read incoming arrays according to the current format. Each data point in an array is a pair of num­bers, 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 Agilent 8702E’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
"#A"
, 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
1-14
Writing Programs
Reading Data
by the same header as in FORM 1. Each number consists of a 1-bit sign, an 8-
bit biased exponent, and a 23-bit mantissa. FORM 2 is the format of choice if
your computer supports single-precision floating-point numbers.
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 Agilent 8702E 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-12. There is no header. The
Agilent 8702E uses FORM 4 to transfer non-array data such as 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 Agilent 8702E terminates each transmission by asserting the EOI inter-
face line with the last byte transmitted. Table 1-5 on page 1-15 offers a com-
parative overview of the five array-data formats.
Table 1-5. Agilent 8702E/Option 011 Array-Data Formats
Format Type Type of Data
1 Internal Binary 3 6 1206 1210
2 IEEE 32-bit
Floating-Point
3 IEEE 64-bit
Floating-Point
4 ASCII Numbers 24 50 10,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
4 8 1608 1612
8 16 3216 3220
4 8 1608 1612
Bytes per Data
a
Point
Bytes per 201 Point Trace
Total Bytes with Header
10,050
b
1-15
Writing Programs
Reading Data
Trace-data transfers
Transferring trace data from the Agilent 8702E using an instrument controller can be divided into three steps:
1
allocating an array to receive and store the data
2
commanding the Agilent 8702E to transmit the data
3
accepting the transferred data
Data residing in the Agilent 8702E 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 Agilent 8702E 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 Agilent 8702E can transmit data over GPIB 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-16 illustrates an ASCII transfer using Form 4. For more information on the various data formats, refer to “Array-data formats” on page 1-14. 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-20.
Frequency-related arrays
Frequency-related values are calculated for the Agilent 8702E 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 calculated easily because the 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-16.
1-16
Writing Programs
Reading Data
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-25 demon-
strates 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 Agilent 8702E 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-17
Writing Programs

Data-Processing Chain

Data-Processing Chain
This section describes the manner in which the Agilent 8702E processes mea­surement data. It includes information on data arrays, common output com­mands, data levels, the learn string, and the calibration kit string.
Data arrays
Figure 1-1 on page 1-19 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.
1-18
OUTPMEMO
, but it
Writing Programs
Data-Processing Chain
Figure 1-1. The data-processing chain
All the data-output commands are designed to ensure that the data transmit­ted 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 transmit­ting data.
OUTPMSTA
ensures 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.
OUTPMWID
ensures that a bandwidth search has been executed for the current trace before transmitting data. If the bandwidth-search function is not activat­ed, it will activate the bandwidth-search function long enough to update the
1-19
Writing Programs
Data-Processing Chain
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 data­processing chain in Figure 1-1 on page 1-19.
The following list describes the different types of data that are available from the Agilent 8702E.
Raw data
Error-corrected data
Formatted data
The basic measurement data, reflecting the stimulus parameters, averaging, and IF bandwidth are forms of raw data. If a full 2-port measurement calibra­tion 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
OUTPRAW1, OUTPRAW2, OUTPRAW3, OUTPRAW4
. Normally, only raw format 1 is available, and it holds the current parameter. If a 2-port measurement cali­bration is active, the four arrays refer to S
, S21, S12, and S22 respectively. This
11
data is represented in real/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
OUTPMEMO
The
command reads the trace memory, if available. The trace
OUTPDATA
command.
memory also contains error-corrected data. Note that neither raw nor error­corrected data reflect such post-processing functions as electrical-delay off­set, 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 out­put depend on the current display format. Refer to Table 1-4, “Units as a Func-
tion of Display Format,” on page 1-13 for the various units defined as a
function of display format.
Calibration coefficients
The results of a measurement calibration are arrays containing calibration coefficients. These calibration coefficients are then used in the error-correc­tion routines. Each array corresponds to a specific error term in the error model. The
Agilent 8702E 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.
1-20
Writing Programs
Data-Processing Chain
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-pro­cessing is unnecessary (possibly in cases involving smoothing), error-cor­rected data may be more desirable. Error-corrected data also affords the user the opportunity to input the data to the Agilent 8702E and apply post-pro­cessing at another time.
Learn string and calibration-kit string
The learn string is a summary of the instrument state. It includes all the front­panel settings, the limit-test tables, and the list-frequency table for the cur­rent 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 Agilent 8702E to start transmitting the binary string. The string has a fixed length for a given firmware revision. It cannot 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 dif­ferent 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 cannot be longer than 1000 bytes.
1-21
Writing Programs

Controlling Command Execution

Controlling Command Execution
Some Agilent 8702E commands require relatively longer execution times due to measurement sweeps or other processes and, occasionally, there is a need to know when certain Agilent 8702E operations have been completed. There is an operation-complete function (OPC) that allows a synchronization of pro­grams with the execution of certain key commands. Table 1-6 on page 1-23 lists all the OPC-compatible commands for the instrument.
Synchronized program execution with OPC command
Issue an or ESR operation-complete bit will then be set after the execution of the OPC­compatible command. For example, issuing be set when the single sweep is finished. Issuing the Agilent 8702E to output a one (1) when the command execution is com­plete.
Addressing the Agilent 8702E to talk after issuing
addressed to talk without selecting output
Agilent 8702E will halt the computer by not transmitting the one (1) until the command has completed. For example, executing immediately interrogating the Agilent 8702E, causes the bus to halt until the instrument preset is complete and the Agilent 8702E outputs a one (1).
As another example, consider the timing of sweep completion. Send the com­mand string the Agilent 8702E 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 Agilent 8702E as the completion of the single sweep. The program then waits until the sweep is completed before continu­ing operation. At this point a valid trace exists and the trace data can be read into the computer.
OPC
OPC?
or
SWET 3 S;OPC?;SING;
prior to an OPC-compatible command. The status byte
OPC SING
to the Agilent 8702E. This string sets
causes the OPC bit to
OPC?
, in place of
OPC?;
will not cause an
error, but the
OPC?;PRES;
OPC
, causes
, and then
OPC-compatible commands delay execution of other commands
The Agilent 8702E cannot process other commands while executing OPC­compatible commands. Once an OPC-compatible command is received, the Agilent 8702E reads new commands into the input buffer, but it will not begin
1-22
Writing Programs
Controlling Command Execution
the execution of any commands until the completion of the OPC-compatible command. When the 15-character input buffer is full, the Agilent 8702E holds off the bus until it is able to process the commands in the buffer.
Table 1-6. OPC-Compatible Commands
CHAN HARM REFD
a
CLASS CLEARALL ISOD
DATI MANTRIG RST DONE NOOP SAV EDITDONE NUMG SAVC EXTTOFF PRES SAVE EXTTON RAID SAVEREG EXTTPOIN
FREQOFF
a
FWDI
a
FWDM
a. The CLASS commands are OPC-compatible if there is only one standard in the class.
INSM RESPDONE
a
REV
RAIRESP
RAIISOL
a
a
SING
STAN
RECA TRAD
RECAREG WAIT
1-23
Writing Programs

Calibrating for Measurements

Calibrating for Measurements
Measurement calibration over GPIB 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-25 indicates the relation- ship between calibration and classes. Table 1-8 on page 1-25 describes the cal­ibration arrays.
To calibrate the instrument
1
Select a calibration kit, such as 50 ohm type N (
CALKN50
over GPIB). Load 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
(
over GPIB). During a 2-port calibration, the reflection,
1-port (
11
CALIS111
FORWARD: OPEN
over GPIB).
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 (
5
The
STANA
STANA
STANG
to
STANG
to
over GPIB).
commands are all held commands because they trigger a sweep. If a class has only one standard, that means it will trigger a sweep when called. The class command will be held, also.
6
If, during a calibration, two standards are measured to satisfy one class, the class must be closed with
7
Declare the calibration done, such as with
DONE;
.
DONE 1-PORT CAL (SAV1
over
GPIB).
1-24
Table 1-7. Relationship Between Calibration and Classes
Writing Programs
Calibrating for Measurements
Response
Class Response
and Isolation
a
Reflection
: S11A, RE FW MTCH • S11B, LN FW MTCH • S11C, LN FW TRAN • S22A, LN RV MTCH • S22B, LN RV TRAN • S22C, LN RV TRAN
S11 1-port
S22 1-port
One path 2-port
Full 2­port
TRL*/ LRM*
•••
Response and Match E/O
Response and Match O/E
Transmission:
Forward match • Forward trans • Reverse match • Reverse trans
a.
Isolation:
Forward • • Reverse •
•••
Response • Response and isolation:
Response • Isolation •
a. These subheadings must be called when doing 2-port calibrations.
Table 1-8. Calibration Arraysa
Array Response
1ER or ET
2E
3 E
4E
5E
6E
7 E
8 E
b
Response and Isolation
d
E
(ED)
X
(ER)ESFE
T
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
E
D
E
S
E
R
2-port
E
DF
E
SF
E
RF
E
XF
E
LF
E
TF
DR
SR
c
TRL*/LRM*
EDF
ESF
ERF
E
XF
ELF
ETF
E
DR
ESR
1-25
Writing Programs
Calibrating for Measurements
Table 1-8. Calibration Arraysa
Array Response
9 E
10 E
11 E
12 E
a. Meaning of first subscript: D=directivity, S=source match, R=reflection tracking, X=crosstalk, L=load match, T=transmission 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
Response and Match E/O
Response and Match O/E
1-port
2-port
RR
XR
LR
TR
c
TRL*/LRM*
ERR
EXR
ELR
ETR
1-26
Writing Programs

Debugging Programs

Debugging Programs
A GPIB diagnostic feature (debug mode) is available in the GPIB menu. Acti­vating the debug mode causes the analyzer to scroll incoming GPIB commands across the display. Nonprintable characters are represented with a
π
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.
GPIB DIAG ON OFF
so that ON is highlighted.
1-27
Writing Programs

Understanding File Names

Understanding File Names
Disk files created by the analyzer consist of a state name of up to eight charac­ters, 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, indicating 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 from the disk. The other files are not meant to be decoded.
Table 1-9 on page 1-28 lists the appended characters and their meanings.
Table 1-9. Disk File Names
Appended Character 1
I Instrument state G Graphics 1 Display graphics
D Error corrected data 1 Channel 1
R Raw data 1 to 4 Channel 1, raw arrays 1 to 4
F Formatted data 1 Channel 1
M Memory trace 1 Channel 1
P Instrument state appendix CCal kit K 1 Cal data, channel 1 0 Stimulus state
2 Cal data, channel 2 0 to C Same as channel 1
Definition
Appended Character 2
0 Graphics index
2 Channel 2
5 to 8 Channel 2, raw arrays 1 to 4
2 Channel 2
2 Channel 2
1 to 9 Coefficients 1 to 9 A Coefficient 10 B Coefficient 11 C Coefficient 12
Definition
1-28
Writing Programs

Drawing Graphics on the Display

Drawing Graphics on the Display
You can use the Agilent 8702E’s screen as a graphics display for showing con­nection diagrams or custom instructions to an operator. For programming pur­poses, consider the display as a separate device; it has its own GPIB address. The display’s address is configured automatically based on the address of the Agilent 8702E.
The display’s default GPIB address is 17. If you change the Agilent 8702E’s default address, you can determine the display’s new address as follows. If the Agilent 8702E address is an even number, add 1 to the address. If the Agilent 8702E address is an odd number, subtract 1 from the address.
The display accepts a subset of Hewlett-Packard commands. These commands are documented in Chapter 4, “Graphics Lan-
guage Reference”. Some HP-GL commands are accepted but ignored. These
commands are documented in Table 1-10 on page 1-29.
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
1
Graphics Language (HP-GL)
Complete Display (includes annotation and softkeys):
• length: 0 to 5850
• height: 0 to 4095
Table 1-10. Ignored but Accepted HP-GL Commands
Command Description
IM Input service request mask
1. Hewlett-Packard and HP are registered trademarks of Hewlett-Packard Company.
1-29
Writing Programs
Drawing Graphics on the Display
Table 1-10. Ignored but Accepted HP-GL Commands
Command Description
IP Input P1,P2 scaling points
IW Input window
OC Output current pen position
OE Output error
OI Output identity
OS Output status
SL Character slant
SR Relative character size
1-30
Writing Programs

Monitoring the Instrument

Monitoring the Instrument
Almost every program that you write will need to monitor the Agilent 8702E for its operating status and errors. This includes querying execution or com­mand errors and determining whether or not measurements have been com­pleted. 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-31
Writing Programs
Monitoring the Instrument
Figure 1-2. Status reporting structure
1-32
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 sum­mary 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 regis­ter or queue should be read to obtain the status information and clear the con­dition. 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 or STB
set by the operator during the execution of a test sequence.
. When using either command, the sequencing bit can be
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 GPIB
• contains a bit that is set when the analyzer has data to transmit over GPIB
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
command 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-36.) 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-33
Writing Programs
Monitoring the Instrument
Table 1-11. Bits in the Status Byte
Bit Definition
0
1
2
3
4
5
6
7
Waiting for reverse GET.
instrument has stopped, waiting for the operator to connect the device for reverse measurement.
Waiting for forward GET.
instrument has stopped, waiting for the operator to connect the device for forward measurement.
Check event-status-register B.
been set.
Check error queue.
queue, but has not been read yet.
Message in output queue.
not been read yet.
Check event-status register.
set.
Request service.
An instrument preset has been executed.
Preset.
A one path, 2-port measurement calibration is active, and the
A one path, 2-port measurement calibration is active, and the
One of the enabled bits in event status register B has
An error has occurred and the message has been placed in the error
A command has prepared information to be output, but it has
One of the enabled bits in the event-status register has been
One of the enabled status-byte bits is causing an SRQ.
The Event-Status Register and Event-Status-Register B
The event-status register and event-status register B are the other two regis­ters 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 the the summary bit is enabled in the status byte, an SRQ will be generated. The SRQ will not be cleared until one of the six following conditions transpire:
ESEnn
nn
. The units variable nn represents
and
ESNBnn
, both of
1-34
1
The event-status register is read, clearing the latched bit.
2
The summary bit in the status byte is disabled.
3
The event-status-register bit is disabled.
Writing Programs
Monitoring the Instrument
4
The status registers are cleared with the
5
An instrument preset is performed.
6
Instrument power is cycled
CLES
command.
Service requests generated when there are error messages or when the instru­ment is waiting for the Group Execute Trigger (GET) command are cleared by:
• reading the errors
• issuing GET (disabling the bits)
• clearing the status registers
•cyling
Table 1-12. Bits in the Event-Status Register
Bits Definition
0
1
2
Operation complete.
operation.
Request control.
requires control of a peripheral and needs control of GPIB. Requires pass-control mode.
Query error.
queue to transmit.
A command, for which OPC has been enabled, has completed
The analyzer has been commanded to perform an operation that
The analyzer has been addressed to talk but there is nothing in the output
3
4
5
6
7
Sequence bit.
Execution error.
Syntax error.
can only be cleared by a device clear or an instrument preset.
User request.
Power on.
A sequence has executed the assert SRQ command.
A command was received that could not be executed.
The incoming GPIB commands contained a syntax error. The syntax error
The operator has pressed a front-panel key or turned the RPG.
A power-on sequence has occurred since the last read of the register.
1-35
Writing Programs
Monitoring the Instrument
Table 1-13. Bits in the Event-Status Register B
Bit Definition
Error Messages
0
1
2
3
4
5
6
7
Single sweep, number of groups, or calibration step complete.
calibration step has been completed since the last read of the register.
Service routine waiting or done.
is waiting for an operator response.
Data entry complete.
since the last read of the register.
Limit failed, Channel 2.
Limit failed, Channel 1.
Search failed, Channel 2.
value was not found.
Search failed, Channel 1.
value was not found.
Copy Complete.
A terminator key has been pressed or a value entered over GPIB
A copy has been completed since the last read of the register.
An internal service routine has completed operation, or
Limit test failed on Channel 2.
Limit test failed on Channel 1.
A marker search was executed on Channel 2 but the target
A marker search was executed on Channel 1 but the target
A single sweep, group, or
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 mes­sages 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-36
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 Agilent 8702E responds to the abort message (IFC) by halting all listener, talker, and controller functions.
The Agilent 8702E responds to the device clear commands (DCL, SDC) by clearing the input and output queues and clearing any GPIB errors. The status registers and the error queue are unaffected.
The Agilent 8702E will go into local mode if the local command (GTL) is received, the remote line is unasserted, or the front-panel pressed. Changing the Agilent 8702E’s GPIB status from remote to local does not affect any of the front-panel functions or values.
If the Agilent 8702E 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 Agilent 8702E does not respond to parallel-poll configure (PPC) or paral­lel-poll unconfigure (PPU) messages.
If the Agilent 8702E 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 Agilent 8702E is not requesting control, it will immediately pass control to the system controller’s address.
LOCAL
key is
Remote
The Agilent 8702E will go into remote mode when the remote line is asserted and the Agilent 8702E is addressed to listen. While the Agilent 8702E is held in remote mode, all front panel keys (with the exception of abled. Changing the Agilent 8702E’s GPIB status from remote to local does not affect any front panel settings or values.
LOCAL
) are dis-
1-37
Writing Programs
Response to IEEE-488 Universal Commands
Serial Poll
Trigger
The Agilent 8702E will respond to a serial poll with its status byte, as defined in the “The Status Byte” on page 1-33. To initiate the serial-poll sequence, address the Agilent 8702E to talk and issue a serial-poll enable command (SPE). Upon receiving this command, the Agilent 8702E 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 Agilent 8702E responds to device trigger by taking a single sweep. If a one-path, 2-port measurement calibration is active, the Agilent 8702E will set the waiting-for-Group-Execute-Trigger bits in the status byte. If waiting-for-forward-GET is set, the Agilent 8702E 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 Agilent 8702E will assume the device is connected for reverse measurement. The Agilent 8702E 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 Agilent 8702E will not respond to GET if it is not in hold mode.
1-38
2

Programming Examples

Programming 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 Agilent 82335B interface card.
For the QuickBASIC and QuickC languages, examples are provided for both the Agilent 82335B Interface card and the National Instruments card.
®
is a U.S. registered trademark of Microsoft Corp.
2-2
What you’ll find in this chapter
Programming Examples
Programming Examples
Measurement Setup
Measurement Calibration
Measurement Data Transfer
Measurement Process Synchronization
System Setups
Limit-Line Testing
Preparing Measurement Settings 2-4 Verifying Measurement Settings 2-6
S11 1-Port Measurement Calibration 2-8 Full 2-Port Measurement Calibration 2-12
Data Transfer Using Markers 2-16 Data Transfer Using ASCII Format 2-20 Data Transfer Using Floating-Point Numbers 2-23 Data Transfer Using Frequency-Array Information 2-25 Data Transfer Using Internal Binary Format 2-28
Using Error Queue 2-30 Generating Interrupts 2-33 Power Meter Calibration 2-37
Using the Learn String 2-41 Reading Calibration Data 2-44 Using Instrument States 2-48
Setting a List Frequency Sweep 2-52 Selecting a Single Segment 2-56 Setting up Limit Lines 2-59 Performing Pass/Fail Tests 2-62
Report Generation
Operation Using Talker/Listener Mode 2-66 Controlling Peripherals 2-69 Printing Via the Serial Port 2-73 Plotting Data 2-75 Reading Plot Files from Disk 2-78 Reading ASCII Instrument Files 2-86
2-3
Programming Examples

Preparing Measurement Settings

Preparing Measurement Settings
File Name
Description
EXAMP1A.BAS
Use the same command sequence when remotely setting up measurements via GPIB. There is no required order.
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
reflection measurement as a function of log magnitude and phase over
11
the selected frequency range. The displays are autoscaled and the program ends.
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 !
2-4
Preparing Measurement Settings
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 GPIB control 420 END
Programming Examples
2-5
Programming Examples

Verifying Measurement Settings

Verifying Measurement Settings
File Name
Description
EXAMP1B.BAS
This example shows how to read analyzer settings into your program. Informa­tion on the command formats and operations is located in Chapter 1, “Writing
Programs”. Appending a question mark (?) to a command that sets an ana-
lyzer 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 dis­play.
• 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.
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
2-6
Verifying Measurement Settings
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 GPIB control 390 END
Programming Examples
2-7
Programming 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 GPIB. You can use the following sequence for performing either a manual mea­surement calibration or a remote measurement calibration via GPIB:
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 ibration kit. Selecting
1-port measurement calibration, use a 7-mm or 3.5-mm cal-
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 GPIB is very similar. When
11
using a 7-mm or 3.5-mm calibration kit, sending CLASS11B will automatically measure the short. With Type-N, sending CLASS11B brings up the menu with the male and female short options. To select a standard, use STANA or
2-8
Programming Examples
S11 1-Port Measurement Calibration
STANB. The STAN command is appended with the letters A through G, corre­sponding 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 calibra-
11
tion over GPIB, using the Agilent 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 repre­sented 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
Programming 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 con­troller’s display. Pressing
ENTER
on the controller continues the program and measures the standard. The program displays a message when the measure­ment calibration is complete.
10 ! This program performs a 1-port calibration on the Agilent 8702E. 20 ! It guides the operator through a 1-port calibration 30 ! using the Agilent 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 !
2-10
Programming Examples
S11 1-Port Measurement Calibration
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 GPIB control 520 ! 530 END 540 ! 550 ! **************************** Subroutines ****************************** 560 ! 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-11
Programming Examples

Full 2-Port Measurement Calibration

Full 2-Port Measurement Calibration
File Name
Description
EXAMP2B.BAS
The following example shows how to perform a full 2-port measurement cali­bration using the Agilent 85032B calibration kit. The main difference between this example and the S
1-Port Measurement Calibration example is that the
11
full 2-port measurement calibration process allows removal of both the for­ward- and 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
• PORT 1 is a female test port
• PORT 2 is a male test port
• Agilent 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
ENTER
on the computer keyboard con­tinues the program and measures the standard. You have the option of omit­ting the isolation portion of the measurement calibration. If you perform the
2-12
Programming Examples
Full 2-Port Measurement Calibration
isolation portion of the calibration, averaging is automatically employed to ensure a valid calibration. The program will display a message when the mea­surement calibration is complete.
10 ! This program performs a full 2-port measurement calibration. 20 ! It guides the operator through a full 2-port calibration 30 ! using the Agilent 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”
2-13
Programming Examples
Full 2-Port Measurement Calibration
530 ! 540 OUTPUT @Nwa;”REFD;” ! Reflection portion complete 550 ! 560 OUTPUT @Nwa;”TRAN;” ! Transmission portion begins 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 GPIB control 1080!
2-14
Programming Examples
Full 2-Port Measurement Calibration
1090 END 1100! 1110! ************************* Subroutines ******************************* 1120! 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-15
Programming 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, “Agilent 8702E/Option 011 Array-Data Formats,” on page
1-15. This table shows the number of bytes required to transfer a 201-point
trace in each format. As you will see in the first example, ASCII data (form 4) is the easiest to transfer, but 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. Using 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-14 discusses the different types of formats and their compositions.
Data may also be transferred from several different locations in the trace-pro­cessing 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-3.
"#A"
2-16
Programming Examples
Data Transfer Using Markers
In this section, an example of each of the data formats will be shown for com­parison. 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 trans­fers, 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-25.
Arrays which will be interpreted or processed within your program should be in Form 2, 3, or 5, as appropriate for your computer. “Data Transfer Using
Floating-Point Numbers” on page 2-23 shows how to transfer a trace in these
formats.
In “Data Transfer Using ASCII Format” on page 2-20 and “Data Transfer Using
Floating-Point Numbers” on page 2-23, the frequency counterpart of each
data point in the array is also determined. Many applications generate a fre­quency 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-20, 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 lim­its 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-23, 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-17
Programming 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-3 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 con­troller 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 mean­ingless in this data format.
Tab le 5-2 on page 5- 5 provides an easy reference for the types of data
returned with the various data-format operational modes.
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 !
2-18
Data Transfer Using Markers
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 GPIB control 320 END
Programming Examples
2-19
Programming 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.
Tab le 5-2 on page 5- 5 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 each data point consists of two numbers, a comma, and a line feed, each data point takes 50 bytes. Therefore, a 201-point transfer takes 10,050 bytes. This form is useful only when input-data formatting is difficult with the instrument controller. Refer to Table 1-5, “Agilent 8702E/Option 011
Array-Data Formats,” on page 1-15 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-25 for an example of this tech-
nique.
2-20
Programming 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 val­ues read with the active marker with the results printed on the controller con­sole. 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, “Agilent 8702E/Option 011 Array-Data Formats,” on
page 1-15 for a list of the specific data that is provided with each format. The
data from
OUTPFORM
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.
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
2-21
Programming Examples
Data Transfer Using ASCII Format
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 GPIB control 520 ! 530 PRINT 540 PRINT “Position the marker with the knob and compare the values” 550 ! 560 END
2-22
Programming Examples

Data Transfer Using Floating-Point Numbers

Data Transfer Using Floating-Point Numbers
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 #A 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 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 × 25 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 + 4 bytes for the header). Refer to Table 1-5, “Agilent 8702E/Option 011 Array-Data Formats,” on page
1-15 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.
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 val­ues with the analyzer’s marker values.
2-23
Programming 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 GPIB control 490 ! 500 PRINT 510 PRINT “Position the marker with the knob and compare the values.” 520 ! 530 END
2-24

Data Transfer Using Frequency-Array Information

Data Transfer Using Frequency-Array Information
Programming Examples
File Name
Description
EXAMP3D.BAS
This example explains how to use the limit-test array to read the correspond­ing 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 com­pute 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-25
Programming Examples
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 fre­quency 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.
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 !
2-26
Programming Examples
Data Transfer Using Frequency-Array Information
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 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 GPIB control 630 PRINT ! Blank line 640 PRINT “Position marker and observe frequency point spacing” 650 ! 660 END
2-27
Programming 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. Com­pare the two numbers to be sure that the transfer was completed.
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 !
2-28
Data Transfer Using Internal Binary Format
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 GPIB control 480 END
Programming Examples
2-29
Programming 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, 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
PERRO
causes the analyzer to transmit the error number and message of 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.
OUTPERRO
command.
OUT-
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 mes­sage, and the second line will be the queue, you can either loop until the
2-30
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:
Programming 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 ana­lyzer 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 softkey 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 calibra­tions. 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 con­troller display as well. A complete list of error messages and their descriptions can be found in "Error Messages" in the
Agilent 8702E 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.
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
2-31
Programming Examples
Using Error Queue
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-32

Generating Interrupts

Programming Examples
Generating Interrupts
File Name
Description
EXAMP4B.BAS
Interrupts can be generated using the status-reporting mechanism. The sta­tus-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, illuminat­ing the (S) indicator in the GPIB status block on the front panel of the ana­lyzer. 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, execut­ing rized by bit 2 in the status byte.
To generate an SRQ from an event-status register, enable the desired event­status-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
com-
ESE 66;
2-33
Programming 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 GPIB 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, the program prints
FROM ANALYZER
.
• If bit 5 in the event-status register is NOT set, the program prints
ERROR BIT NOT SET.
SYNTAX ERROR
SYNTAX
• The SRQ interrupt is re-enabled on the bus.
• The interrupt is de-activated.
• 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 sec­ond 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 GPIB 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.
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 !
2-34
Programming Examples
Generating Interrupts
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 GPIB 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 GPIB 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 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
2-35
Programming Examples
Generating Interrupts
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 GPIB 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 GPIB control 770 END
2-36

Power Meter Calibration

Programming 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 manual. The example described will perform the sample and sweep calibration under GPIB remote control.
The power meter is usually connected to ments. Its address must be set correctly and it must be connected to GPIB. The power meter address can be set by pressing:
ADDRESS P MTR/GPIB
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 GPIB, 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 con­tinues 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
Agilent 8702E Reference
PORT
1 for the forward measure-
LOCAL
SET ADDRESSES
,
POWER MTR: [ ]
Agilent 8702E Reference
until the model
manual.
,
2-37
Programming 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 GPIB 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, requesting control. The system controller display prints when control is passed to the analyzer. The controller displays
request
while the analyzer has control and is reading the power meter.
WAITING FOR GPIB CONTROL
Passing Control
Waiting for
when it is
The interaction of the messages and the movement of the cursor allow obser­vation of the calibration process. Once the calibration is complete, the ana­lyzer displays displays,
POWER METER CAL IS COMPLETE
Finished with Power meter Cal
and the system controller
.
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 GPIB control, and the program ends.
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
2-38
Power Meter Calibration
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 GPIB 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 GPIB, 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” 570 OUTPUT @Nwa;”USEPASC;” ! Enable pass control operation 580 OUTPUT @Nwa;”TAKCS;” ! Take Cal Sweep 590 !
Programming Examples
2-39
Programming Examples
Power Meter Calibration
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 GPIB interface state information register. 760 STATUS 7,6;Hpib ! Test GPIB 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 GPIB control 1070 END
2-40

Using the Learn String

Programming Examples
Using the Learn String
File Name
Description
EXAMP5A.BAS
This section provides several different examples of performing analyzer sys­tem 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
Agilent 8702E User’s Guide
age 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 the solutions described in this sec­tion become viable.
The purpose of this example is to demonstrate several programming options for storing and recalling entire instrument states over GPIB. 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 control­ler itself.
Using the learn string is a very rapid way of saving the instrument state. How­ever, using direct disk access has the advantage of automatically storing cali­brations, 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 as if a calibration was performed. By sending both sets of data, the analyzer may be setup rapidly for a measurement.
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.
for detailed information on the analyzer’s internal stor-
2-41
Programming Examples
Using the Learn String
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
OUTPLEAS
commands and input to the analyzer with
LRN
or
LRN?
INPULEAS
mands . This array is always transmitted in Form 1, the internal format for the analyzer. It cannot be longer than 3000 bytes.
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.
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 GPIB 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 !
or
com-
2-42
280 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish 290 ENTER @Nwa;Reply ! Read the 1 when complete 300 LOCAL @Nwa ! Release GPIB control 310 END
Programming Examples
Using the Learn String
2-43
Programming 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-cor­rected 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 array­data formats also apply to the transfer of calibration-coefficient arrays. "Print­ing, Plotting, or Saving Measurement Results" in the
contains information on the storage locations for calibration coeffi-
Guide
cients 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 nec­essary to know the type of calibration to be read out. Attempting to read an array not being used in the current calibration causes the warning
REQUESTED DATA NOT CURRENTLY AVAILABLE
A computer can also store calibration coefficients in the analyzer. To do this, declare the type of calibration data to be stored in the analyzer just as if you were to perform that calibration. Then, instead of calling up different classes, transfer the calibration coefficients using the variables nn represent the calibration number and range from 01 to 12. When all the coefficients are stored in the analyzer, activate the calibration by issu­ing the mnemonic
SAVC
, ... through
and trigger a sweep on the analyzer.
OUTPCALC12
INPUCALC
Agilent 8702E User’s
. Each calibration type
.
nn
commands. The
2-44
Programming 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 instru­ment. 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 calibra­tion on the analyzer and continues the program. The computer reloads the old calibration. The operator should not preset the analyzer because the instru­ment settings must be the same as those that were present when the calibra­tion was performed.
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-45
Programming 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-46
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 GPIB control 710 END
Programming Examples
Reading Calibration Data
2-47
Programming 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 when the analyzer’s internal memory is full or when there are other internal-memory 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 exam­ple program is a potential solution.
The example will request the learn string and a calibration array from the ana­lyzer 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 con­troller and restored to the analyzer.
NOTE
The disk file can only be created once. Errors will occur if the operator 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 ana­lyzer and written to the disk file with the instrument state. To work with more elaborate calibrations, additional arrays will need to be defined and trans-
2-48
Programming Examples
Using Instrument States
ferred to the disk file. This is not difficult but requires some additional pro­gramming steps which were omitted in the interest of presenting a simple example.
The following is an outline of the program’s processing sequence:
• The integers for reading the headers are defined.
• The system is initialized.
• An array is created to hold the learn string.
• The learn string is requested by the controller.
• The number of points in the trace is read.
• The controller allocates an array for the calibration data.
• The calibration data is read into the controller.
• The controller creates and assigns a data file for the calibration array and the learn string.
• The learn string and calibration array are stored in the disk file.
• The operator presses
ENTER
on the controller to read the calibration data back
into the analyzer.
• The learn string is read from the disk file and output to the analyzer.
• The calibration array is read in from the disk file and stored in the analyzer.
• The analyzer is returned to continuous-sweep mode.
• The analyzer is released from remote control and the program ends.
Running the Program
Setup the analyzer and perform a through calibration.
Run the program. The program prompts the operator to change the state of the analyzer and then press is stored on the disk file in the controller. Pressing
ENTER
to continue. At this point, the analyzer state
ENTER
will begin the trans­fer from the disk file to internal arrays within the controller and then to the analyzer. Once completed, the original state will be restored, the analyzer will be sweeping, the analyzer will be calibrated, and
COR
will be displayed on the
analyzer.
10 ! This program reads an instrument state and stores it in a disk file. 20 ! The learn string and CAL array are both read into the controller and 30 ! then transferred to a disk file for storage. The file contents are 40 ! then restored to the analyzer. The analyzer is preset to the default 50 ! settings before the instrument state is transferred back. 60 ! 70 ! EXAMP5C 80 ! 90 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer 100 ASSIGN @Nwa_bin TO 716;FORMAT OFF ! Assign a binary path 110 ! 120 INTEGER Head,Length ! Integer 2 byte format for headers 130 !
2-49
Programming Examples
Using Instrument States
140 CLEAR SCREEN 150 ! Initialize the analyzer 160 ABORT 7 ! Generate an IFC (Interface Clear) 170 CLEAR @Nwa ! SDC (Selected Device Clear) 180 ! 190 ! Read in the learn string as a form 1 binary data trace 200 DIM Learn$[3000] ! Array to hold learn string 210 ! 220 OUTPUT @Nwa;”OPC?;SING;” ! Place analyzer in single sweep 230 ENTER @Nwa;Reply ! Read the 1 when complete 240 ! 250 OUTPUT @Nwa;”OUTPLEAS;” ! Request learn string 260 ENTER @Nwa USING “+,-K”;Learn$ 270 ! 280 ! Allocate an array for storing the CAL data 290 OUTPUT @Nwa;”POIN?;” ! Find number of points in trace 300 ENTER @Nwa;Num_points ! Read number to allocate array 310 ALLOCATE Cal_array(1:Num_points,1:2) ! Real and Imag for each point 320 ! 330 ! Read Cal array 340 OUTPUT @Nwa;”FORM3;” ! Form 3 64 bit floating point data 350 OUTPUT @Nwa;”OUTPCALC01;” ! Request the cal array 360 ! 370 ! Read the #A and 2 byte length as integers 380 ENTER @Nwa_bin;Head,Length,Cal_array(*) ! Read cal array data 390 ! 400 ! Write instrument state data to disk file 410 ! CREATE BDAT “DATA_FILE:,1406”,1,Length+3000 ! Create data file once 420 ASSIGN @File TO “DATA_FILE:,1406 “ ! Assign I/O path to file 430 OUTPUT @File;Learn$ ! Send learn string to disk file 440 OUTPUT @File;Head,Length,Cal_array(*) ! Send CAL arrays to disk file 450 ASSIGN @File TO * ! Close file 460 ! 470 INPUT “Cal data received. Press ENTER to send it back.”,A$ 480 ! 490 ! Read arrays from file 500 ! 510 DIM Learn2$[3000] ! String for learn string storage 520 ASSIGN @File TO “DATA_FILE:,1406” ! Open file for reading arrays 530 ENTER @File;Learn2$ ! Read learn string from file 540 ! 550 ENTER @File;Head,Length ! Read CAL data headers from file 560 Size=Length/16 ! Array is 2 numbers, 8 bytes per number 570 ALLOCATE Cal_array2(1:Size,1:2) ! new cal array from file record 580 ENTER @File;Cal_array2(*) ! Read cal array from disk file 590 ! 600 ! Send Learn string back 610 OUTPUT @Nwa;”INPULEAS;”,Learn2$ ! Send learn string array 620 ! 630 ! Send Cal array back 640 OUTPUT @Nwa;”CALIRESP;” ! Send CAL type (Response) 650 OUTPUT @Nwa;”INPUCALC01;” ! Output CAL array to analyzer 660 OUTPUT @Nwa_bin;Head,Length,Cal_array2(*) 670 OUTPUT @Nwa;”OPC?;SAVC;” ! Save the CAL array 680 ENTER @Nwa;Reply ! Read the 1 when complete 690 !
2-50
700 OUTPUT @Nwa;”;CONT;” ! Start the analyzer sweeping 710 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for the analyzer to finish 720 ENTER @Nwa;Reply 730 LOCAL @Nwa ! Release GPIB control 740 END
Programming Examples
Using Instrument States
2-51
Programming Examples

Setting a List Frequency Sweep

Setting a List Frequency Sweep
File Name
Description
EXAMP6A.BAS
Using List-Frequency Mode
The analyzer normally takes data points spaced at regular intervals across the overall frequency range of the measurement. For example, for a 2 GHz fre­quency span using 201 points, data will be taken at intervals of 10 MHz. The list-frequency mode allows the operator to select the specific points, or fre­quency spacing between points, at which measurements are to be made. This mode of operation allows flexibility in setting up tests that ensure device per­formance in an efficient manner. By only sampling specific points, measure­ment time is reduced. These programs emulate operation from the analyzer’s front panel when using list sweeps.
The following two examples illustrate the use of the analyzer’s list frequency mode to perform arbitrary frequency testing. EXAMP6A allows the operator to construct a table of list frequency segments which is then loaded into the analyzer’s list frequency table. There are a maximum of 30 segments available. Each segment stipulates a start and stop frequency, and the number of data points to be taken over that frequency range. EXAMP6B lets the operator select a specific segment to "zoom in." A single instrument can be pro­grammed to measure several different devices, each with its own frequency range, using a single calibration. When a specific device is connected, the operator selects the appropriate segment for that device. Note that list-fre­quency segments can be overlapped, but the total number of points in all the segments must not exceed 1632.
Example
The purpose of this example is to show how to create a list frequency table and transmit it to the analyzer.
The command sequence for entering a list frequency table imitates the key sequence followed when entering a table from the front panel. There is a com­mand for every key press.
Editing a segment takes the same steps as the front panel key sequence, except that the analyzer automatically reorders each edited segment in order of increasing start frequency.
2-52
Programming Examples
Setting a List Frequency Sweep
The list-frequency table is also carried as part of the learn string. While the table cannot be modified as part of the learn string, it can be stored and recalled with very little effort by storing and recalling the learn string. Refer to
“Data-Processing Chain” on page 1-18 for additional information on using
learn strings.
This example takes advantage of the computer’s ability to simplify:
• creating a list frequency table
• editing a list frequency table
The table is entered and completely edited before being transmitted to the an­alyzer. To simplify the programming task, options such as entering center fre­quency, frequency span, or step size are not included.
The list frequency information may be acquired using the limit test results array. The actual stimulus points are available as the first element in the array.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The existing list frequencies are cleared.
• The number of segments to be defined is read in.
• An array for the list segments is defined.
• The parameters for each segment are requested.
• If desired, the segment parameters are re-entered.
• The new list is sent to the analyzer.
• The analyzer is released from remote control and the program ends.
CAUTION
Running the Program
This example program will delete any existing limit lines before entering the new limits. If this is not desired, omit the line(s) that clear the existing limits (in this case, the command
CLEL
). This program begins by presetting the analyzer. The programmer will have to add the necessary command lines to set the analyzer to the specific operating conditions required for testing. The example program will show the limit lines defined, but the limits will always fail without additional analyzer setup.
The program displays the frequency-list table as it is entered. During editing, the displayed table is updated as each line is edited. The table is not re­ordered. At the completion of editing, the table is entered into the analyzer, and list frequency mode is switched ON. During editing, pressing
ENTER
leaves
an entry at the old value.
If the analyzer display is within the range of the segments entered, then the number of points per segment may be observed on the analyzer’s display.
2-53
Programming Examples
Setting a List Frequency Sweep
Activate a marker and select the discrete-marker mode to observe the point spacing. Use an exaggerated scale with just a few points to find the list-fre­quency spacing between points.
10 ! This program shows how to enter and edit a list frequency table. 20 ! Any existing table is deleted and a new table is defined and 30 ! edited. This list is then sent to the analyzer. Any number of 40 ! segments or points may be entered. Be sure not to enter more than 50 ! 1632 points or 30 segments. 60 ! 70 ! EXAMP6A 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 1 when complete 170 ! 180 OUTPUT @Nwa;”EDITLIST;” ! Begin editing the frequency list 190 OUTPUT @Nwa;”CLEL;” ! Clear the existing list frequencies 200 ! 210 INPUT “Number of segments?”,Numb ! Read number of segments to define 220 ALLOCATE Table(1:Numb,1:3) ! Define an array for the list segments 230 ! 240 PRINT USING “10A,15A,15A,20A”;”SEGMENT”,”START(MHZ)”,”STOP(MHZ)”,”NUMBER OF
250 ! 260 FOR I=1 TO Numb ! Cycle through the segments and read in the values 270 GOSUB Loadpoin 280 NEXT I 290 ! 300 LOOP 310 INPUT “DO YOU WANT TO EDIT? Y OR N”,An$ 320 EXIT IF An$=”N” 330 INPUT “ENTRY NUMBER?”,I ! Get an entry number 340 GOSUB Loadpoin ! Go load point 350 END LOOP 360 ! 370 OUTPUT @Nwa;”EDITLIST” ! Send the new list to the analyzer 380 FOR I=1 TO Numb ! Send one segment at a time 390 OUTPUT @Nwa;”SADD;” ! Add a segment 400 OUTPUT @Nwa;”STAR”;Table(I,1);”MHZ;” ! Start frequency 410 OUTPUT @Nwa;”STOP”;Table(I,2);”MHZ;” ! Stop frequency 420 OUTPUT @Nwa;”POIN”,Table(I,3),”;” ! Number of points 430 OUTPUT @Nwa;”SDON;” ! Segment done 440 NEXT I ! Next segment to send to the analyzer 450 ! 460 OUTPUT @Nwa;”EDITDONE;” ! Done with list 470 OUTPUT @Nwa;”LISFREQ;” ! Set list frequency mode 480 ! 490 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for analyzer to finish
POINTS”
2-54
Programming Examples
Setting a List Frequency Sweep
500 ENTER @Nwa;Reply ! Read the 1 when complete 510 LOCAL @Nwa ! Release GPIB control 520 STOP ! End of main program 530 ! 540 ! ***************************Subroutines ****************************** 550 ! 560 Loadpoin: ! Sub to read in each segment value 570 INPUT “START FREQUENCY? (MHZ)”,Table(I,1) ! Read start frequency 580 INPUT “STOP FREQUENCY? (MHZ)”,Table(I,2) ! Read stop frequency 590 INPUT “NUMBER OF POINTS?”,Table(I,3) ! Read number of points in seg 600 IF Table(I,3)=1 THEN Table(I,2)=Table(I,1) ! Single point same start stop 610 ! 620 ! Print new segment into table on display 630 PRINT TABXY(0,I+1);I;TAB(10);Table(I,1);TAB(25); 640 PRINT Table(I,2);TAB(40),Table(I,3) 650 RETURN 660 END
2-55
Programming Examples

Selecting a Single Segment

Selecting a Single Segment
File Name
Description
EXAMP6B.BAS
This example program demonstrates how to define a single segment as the operating frequency range of the analyzer from a table of segments stored in the controller. The program assumes that a list frequency table has already been entered into the analyzer, either manually or using the program in “Set-
ting a List Frequency Sweep” on page 2-52.
The program first loads the list frequency table into the computer by reading the start and stop frequencies of each segment and the number of points for each segment. The segment parameters are displayed on the computer screen and the operator can choose which segment is to be used by the analyzer. Note that only one segment can be chosen at a time.
The following is an outline of the program’s processing sequence:
• The system is initialized.
• The list frequency segment is edited.
• The largest segment number possible is set.
• The highest segment number in use is requested.
• The number of actual segments in use is read in.
• A list frequency table is defined and the segments are read in to the controller from the analyzer.
• The operator selects one of the segments of the sweep.
• The controller "zooms in" and sweeps the defined segment.
• The operator ends the program by entering segment number (0).
• The analyzer returns to sweeping all the segments in the table.
• The activation loop is ended and the program ends.
Running the Program
The program will read the parameters for each list frequency segment from the analyzer and build a table containing all the segments. The parameters of each segment will be printed on the computer screen.
After all the segments are displayed, the program will prompt the operator for a specific segment to be used. Type in the number of the segment and the ana­lyzer will then "zoom in" on that segment. The program will continue looping,
2-56
Programming Examples
Selecting a Single Segment
allowing continuous selection of different segments. To exit the loop, type 0. This will restore all the segments (with the command
ASEG
), allowing
the analyzer to sweep all of the segments, and the program will terminate.
10 ! This program shows how to select a single segment from a list 20 ! frequency sweep and activate it as the sweep. The list frequency 30 ! table is read from the analyzer and displayed on the computer 40 ! screen. The operator is prompted to select a segment and the 50 ! program then activates it. All the segments are activated upon 60 ! completion. 70 ! 80 ! EXAMP6B 90 ! 100 ASSIGN @Nwa TO 716 ! Assign an I/O path for the analyzer 110 ! 120 CLEAR SCREEN 130 ! Initialize the analyzer 140 ABORT 7 ! Generate an IFC (Interface Clear) 150 CLEAR @Nwa ! SDC (Selected Device Clear) 160 ! 170 ! Print header for table of existing segments 180 PRINT USING “10A,15A,15A,20A”;”SEGMENT”,”START(MHZ)”,”STOP(MHZ)”,”NUMBER OF
190 OUTPUT @Nwa;”EDITLIST;” ! Edit list frequency segment 200 OUTPUT @Nwa;”SEDI30;” ! Set largest segment number 210 OUTPUT @Nwa;”SEDI?;” ! Request number of highest segment 220 ENTER @Nwa;Numsegs ! Read number of actual segments 230 ! 240 ! Setup table and read segments from analyzer 250 ALLOCATE Table(1:Numsegs,1:3) ! Allocate table of segments 260 FOR I=1 TO Numsegs ! Cycle through segments 270 GOSUB Readlist ! Read in segment definitions 280 NEXT I ! Next segment 290 ! 300 ! Loop and read segment to be activated 310 LOOP ! Request operator to enter segment 320 INPUT “SELECT SEGMENT NUMBER: (0 TO EXIT)”,Segment 330 EXIT IF Segment=0 ! Exit point 340 OUTPUT @Nwa;”EDITDONE;”;”SSEG”;Segment;”;” ! Set active segment to sweep 350 END LOOP ! End activation loop 360 ! 370 OUTPUT @Nwa;”ASEG;” ! Set all segment sweep 380 DISP “PROGRAM ENDED” 390 ! 400 OUTPUT @Nwa;”OPC?;WAIT;” ! Wait for analyzer to finish 410 ENTER @Nwa;Reply ! Read the 1 when complete 420 LOCAL @Nwa ! Release GPIB control 430 STOP ! End of main program 440 ! 450 ! ************************** Subroutines ******************************* 460 ! 470 Readlist: ! Read segment list from analyzer 480 OUTPUT @Nwa;”EDITLIST;” ! Edit segment list 490 OUTPUT @Nwa;”SEDI”,I,”;” ! Select segment to edit
POINTS”
2-57
Programming Examples
Selecting a Single Segment
500 OUTPUT @Nwa;”STAR;” ! Send start freq to display value 510 OUTPUT @Nwa;”OUTPACTI;” ! Output active function value 520 ENTER @Nwa;Table(I,1) ! Read start frequency 530 OUTPUT @Nwa;”STOP;” ! Send stop freq to display value 540 OUTPUT @Nwa;”OUTPACTI;” ! Output active function value 550 ENTER @Nwa;Table(I,2) ! Read stop frequency 560 OUTPUT @Nwa;”POIN;” ! Send number of points to display 570 OUTPUT @Nwa;”OUTPACTI;” ! Output active function value 580 ENTER @Nwa;Table(I,3) ! Read number of points 590 ! 600 IF I=18 THEN ! Pause if more than 17 segments 610 INPUT “PRESS RETURN FOR MORE”,A$ ! Read Return to continue 620 END IF 630 ! Print new header for segment data 640 IMAGE 4D,6X,4D.6D,3X,4D.6D,3X,4D ! Format image to disp segment data 650 PRINT USING 640;I;Table(I,1)/1.E+6;Table(I,2)/1.E+6;Table(I,3) 660 RETURN 670 ! 680 END
2-58
Loading...