The ANRITSU product(s) listed on the title page is (are) warranted against defects in materials and
workmanship for one year from the date of shipment.
ANRITSU's obligation covers repairing or replacing products which prove to be defective during the
warranty period. Buyers shall prepay transportation charges for equipment returned to ANRITSU
for warranty repairs. Obligation is limited to the original purchaser. ANRITSU is not liable for con
sequential damages.
LIMITATION OF WARRANTY
The foregoing warrantydoes not apply to ANRITSU connectors that have failed due to normal wear.
Also,the warranty does not apply to defects resulting from improper or inadequate maintenance by
the Buyer,unauthorized modification or misuse,oroperation outside of the environmental specifications of the product. No other warranty is expressed or implied, and the remedies provided herein
are the Buyer's sole and exclusive remedies.
TRADEMARK ACKNOWLEDGEMENTS
V Connector and K Connector are registered trademarks of ANRITSU Company.
Windows,Excel,QuickBASIC,C,andQuick C are registered trademarks of Microsoft Corporation.
NOTICE
-
ANRITSU Company has prepared this manual for use by ANRITSU Company personnel and cus
tomers as a guide for the proper installation, operation and maintenance of ANRITSU Company
equipment and computer programs.The drawings, specifications, and information contained herein
are the property of ANRITSU Company,and any unauthorized use or disclosure of these drawings,
specifications, and information is prohibited; they shall not be reproduced, copied, or used in whole
or in part as the basis for manufacture or sale of the equipment or software programs without the
prior written consent of ANRITSU Company.
UPDATES
Updates to this manual, if any, may be downloaded from the Anritsu Internet site at:
http://www.anritsu.com
-
Table Of Contents
Part 1 — GPIB Interface
Chapter 1 — Series 37XXXD GPIB Programmer Interface
This chapter provides an introduction to the 37XXXD GPIB programmer interface and GPIB commu
nications.
Chapter 2 — GPIB Programming Basics
This chapter provides programming information, including equipment and controller setup and ele
mental GPIB programming techniques.
Chapter 3 — Series 37XXXD Programming Examples
This chapter provides sample program elements that demonstrate common 37XXXD operations.
These sample elements are useful as an aid in developing 37XXXD programs.
Part 2 — GPIB Function Groups
Chapter 4 — Measurement Functions
This chapter provides a detailed description of the 37XXXD specific GPIB commands that control the
various data display and measurement control functions of the 37XXXD.
Chapter 5 — Calibration Functions
This chapter describes the 37XXXD error correction (calibration) functions and the commands used
to implement a measurement calibration. It also describes the AutoCal function and provides a
listing of applicable commands.
-
-
Chapter 6 — Markers and Limits Functions
This chapter describes commands used for data analysis, which consists of markers and limits function commands.
Chapter 7 — Remote-Only Functions
This chapter describes 37XXXD functions that support operations typically required when in the
remote-only (GPIB) mode. The commands described consist of data transfer, error reporting,
SRQ/status reporting, 488.2 common commands, and synchronization.
Chapter 8 — System Functions
This chapter describes the commands used to implement certain system functions. They consist of
hard copy, system state, save/recall, disk function, and diagnostics commands.
Chapter 9 — Special Applications Functions
This chapter describes the commands used to implement special measurement functions. They con
sist of time domain, multiple source, sweep control, rear panel output, CW sweep, gain compression,
Millimeter Wave System commands.
-
37XXXD PMi
Part 3 — Programming Reference
Chapter 10 — Command Dictionary
This chapter provides an alphabetically-ordered, dictionary-type listing and description of all
37XXXD GPIB programming commands. The listing for each command includes relevant details
about the command.
Chapter 11 — Instrument Data
This chapter provides general (non-command specific) tabular information for the 37XXXD. Much of
this information is presented in Chapters 4 through 10, but is provided in this chapter for easy
access.
Chapter 12 — Error Messages
This chapter provides a list of all Error Messages including those related to remote-only (GPIB)
operation of the 37XXXD.
Part 4 — Supplemental Data
Appendix A — Introduction to the IEEE 488 Bus
This appendix contains an introduction to the IEEE 488 Bus (GPIB). This material is intended to as
sist new users in understanding GPIB basics.
Appendix B — GPIB Quick Reference Guide
This appendix provides a quick reference to all 37XXXD GPIB commands. Each reference lists the
command name, a brief description of the command function, and a reference to the pertinent
Chapter in this manual.
-
ii37XXXD PM
Part1
TheGPIB
Interface
This part consists of three chapters that describe how the
IEEE- 488 (GPIB) interface is implemented within the 37XXXD
Vector Network Analyzer and how to perform basic GPIB
communications operations.
Chapter 1 – briefly describes the 37XXXD GPIB programmer
interface and describes the communication to and from the
interface during remote-only (GPIB) operation of the 37XXXD.
Chapter 2 – provides a tutorial for performing basic GPIB op
erations such as sending and receiving messages, synchronizing
instrument operations, setting timeouts, and status checking.
Chapter 3 – provides sample program elements to familiarize
the user with 37XXXD programming techniques.They are also
useful as an aid in developing 37XXXD programs.
-
Chapter 1
Series 37XXXD GPIB
Programmer Interface
Table of Contents
1-1MANUAL SCOPE .........................1-3
1-2INTRODUCTION .........................1-3
1-3RELATED MANUALS.......................1-3
1-4REMOTE OPERATION ......................1-3
GPIB Setup Menu ......................1-4
Interface Connection.....................1-5
Local Operation Key .....................1-5
Remote Operation LED Indicators .............1-7
1-5GPIB COMMUNICATION ....................1-8
Bus Interface Function Messages..............1-8
37XXXD Specific Messages .................1-8
Separator
Characters ..........................1-9
Terminator
Character...........................1-9
GPIB Error
Conditions ..........................1-9
Testing the 37XXXD GPIB Operation ...........1-10
1-6IEEE 488.2 SUMMARY .....................1-11
Chapter 1
Series 37XXXD GPIB
Programmer Interface
1-1MANUAL SCOPEThis manual provides IEEE 488 bus (GPIB) programming information
and data for all models of the Series 37000C Vector Network Analyzer.
It contains the entire command set for programming all features. Con
sequently,not all of the codes documented in this manual apply to all
models within the series (372XXD, 373XXD). The reader needs to be
aware of the feature set available within the model for which program
ming is being written. Feature set information is documented in the
applicable operation manual (OM) for any particular model.
1-2INTRODUCTIONThis chapter contains a brief introduction to the 37XXXD GPIB inter-
face and programming environment.
1-3RELATED MANUALSThe series contains an operation manual, a maintenance manual, and
a GPIB Quick Reference Guide (Appendix B). ANRITSU Part numbers
and manual titles are given below:
-
-
Manual TitlePart Number
37XXXD Operation Manual (OM)10410-00261
37XXXD Maintenance Manual (MM)10410-00264
37XXXD GPIB Quick Reference Guide10410-00263
1-4REMOTE OPERATIONThe following sections describe the 37XXXD facilities for remote oper
ation.
The 37XXXD fully supports the IEEE 488.2–1992 GPIB standard. All
37XXXD front panel functions (except Power on/off and GPIB Test)
can be controlled remotely using the GPIB commands listed in this
manual and an external computer equipped with an IEEE 488 GPIB
controller. When in the GPIB operating mode,the 37XXXD VNA func
tions as both a listener and a talker.
-
-
37XXXD PM1-3
REMOTE OPERATIONGENERAL INFORMATION
GPIB Setup MenuThe 37XXXD VNA GPIB address defaults to 6. This value may be
changed via the Utility Menu key's GPIB ADDRESSES menu (below).
Utility
Menu
Figure 1-1. GPIB Address Menu
MENU U1
SELECT UTILITY
.
-
Channels
Measurement
Display
Enhancement
FUNCTION OPTIONS
GPIB ADDRESSES
NETWORK SETUP
DISPLAY
INSTRUMENT
PARAMETERS
DISK UTILITIES
CAL COMPONENT
UTILITIE S
AUTOCAL
UTILITIE S
COLOR CONFIG
DATAON(OFF)
DRAWING
BLANK
FREQ INFORMATION
MENU GP7
GPIB ADDRESSES
IEEE 488.2
GPIB INT ERFACE
ADDRESS
6
DEDICATED
GPIB INT ERFACE
EXTERNAL SOURCE 1
4
EXTERNAL SOURCE 2
5
PLOTTE R
8
POWER MET ER
23
FREQUENCY COUNTER
7
SET DA TE/TIME
PRESS <ENTER >
TO SELECT
OR TURN ON/OFF
1-437XXXD PM
GENERAL INFORMATIONREMOTE OPERATION
Interface ConnectionConnect your external controller to the IEEE 488.2 GPIB interface
connector on the rear panel (left). A pinout listing of this connector is
contained in Figure 1-2.
GPIB
IEEE488.2
Refertomanual
SH1
AH1
T6
L4
SR1
RL1
PP1
DC1
DT1
C0
Dedicated
Communications
E2
forGPIBAddress
GPIB
Peripherals
CAUTION
WARNING
NOOPERATORSERVICE-
ABLEPARTSINSIDE.
>18Kg
REFERSERVICINGTO
QUALIFIEDPERSONNEL.
HEAVYWEIGHT
SH1
AH1
T6
IEEE488.2
L4
ExternalSCSI-2Hard DiskDrive
In 5dBm50±Ω
Ext
AnlgIn
ExternalI/O
BiasFuses
Port1
F
U
S
E
E
S
F
U
U
F
S
E
F.5A250V
GPIB
SR1
RL1
PP1
DC1
DT1
C0
E2
GPIB connector
GPIB
Dedicated
10MHzRef
AnlgOut
Out 5dBm50±Ω
Ext
Port2
E
S
U
F
TestSet
ControlOut
CAUTION
TerminateUnused
+20dBMMAX,0VDC
Inputs
AVOIDSTATICDISCHARGE
IFInputs<270 MHz
a1a2b1b2
Ext
Trigger
Do not connect your external GPIB controller to the “Dedi
cated GPIB Interface” connector (located below the “IEEE
488.2 GPIB interface” connector (left). This dedicated
GPIB port is used by the 37XXXD to control external
GPIB devices,such as a plotter,second frequency source,
NOTE
-
frequency counter,or a power meter.
The GPIB system can accommodate up to 15 devices at any one time.
To achieve maximum performance on the bus,proper timing and volt
age level relationships must be maintained. If either the cable length
between separate instruments or the accumulated cable length be
tween all instruments is too long, the data and control lines cannot be
driven properly and the system may fail to perform. The following
guidelines should be observed:
No more than 15 instruments may be installed on the bus (in-
q
cluding the controller).
Total accumulative cable length (in meters) may not exceed two
q
times the number of bus instruments or 20 meters—whichever is
less.
q
Individual cable length should not exceed 4 meters.
q
2/3 of the devices must be powered on.
q
Devices should not be powered on while bus is in operation (that
is; actively sending or receiving messages, data, etc.).
q
Minimize cable lengths to achieve maximum data transfer rates.
Local Operation KeyPress the Ret Loc key (below) to quickly restore the 37XXXD to local
operation. Local operation will be restored unless the 37XXXD is pro
grammed for local lockout; the Local Lockout LED indicator will be lit.
.
-
Channels
Measurement
Display
Enhancement
-
Clear
Ret Loc
37XXXD PM1-5
REMOTE OPERATIONGENERAL INFORMATION
12
11
10
9
8
7
6
5
4
3
2
1
24
23
22
21
20
19
18
17
16
15
14
13
Pinout Diagram
PINNAMEDESCRIPTION
1-4DIO 1 thru DIO 4Data Input/Output. Bits are HIGH with the data is logical 0 and LOW when the data is
logical 1.
5EOIEnd Or Identify. A low-true state indicates that the last byte of a multibyte message
has been placed on the line.
6DAVData Valid. A low-true state indicates that the talker has (1) sensed that NRFD is
LOW, (2) placed a byte of data on the bus, and (3) waited an appropriate length of
time for the data to settle.
7NRFDNot Ready For Data. A high-true state indicates that valid data has not yet been ac
-
cepted by a listener.
8NDACNot Data Accepted. A low-true state indicates that the current data byte has been ac
-
cepted for internal processing by a listener.
9IFCInterface Clear. A low-true state places all bus instruments in a known state—such
as, unaddressed to talk, unaddressed to listen, and service request idle.
10SRQService Request. A low-true state indicates that a bus instrument needs service from
the controller.
11ATNAttention. A low-true state enables the controller to respond to both it's own lis
ten/talk address and to appropriate interface messages — such as, device clear and
serial poll.
12ShieldGround Point.
13-16DIO 5 thru DIO 8Data Input/Output. Bits are high with the data is logical 0 and LOW when the data is
logical 1.
17RENRemote Enable. A low-true state enables bus instruments to be operated remotely,
GPIB Remote Indicators (above) signal operational status of the GPIB,
as described below:
Remote:
Lights when the 37XXXD switches to remote (GPIB) control. It remains lit until the unit returns to local control.
Talk:
Lights when you address the 37XXXD to talk and remains lit until unaddressed to talk.
Listen:
Lights when you address the 37XXXD to listen and remains lit until
unaddressed to talk.
SRQ:
Lights when the 37XXXD sends a Service Request (SRQ) to the exter
nal controller.The LED remains lit until the 37XXXD receives a serial
poll or until the controller resets the SRQ function.
Local Lockout:
Lights when a local lockout message is received. The LED remains lit
until the message is rescinded. When lit, you cannot return the
37XXXD to local control via the front panel.
Audible IndicatorsA single beep is issued as follows:
(1) on a GPIB error,
(2) when a user warning is issued (see Chapter 12, Operational Error
Messages)
(3) when a test limit line has been exceeded, if the limits testing beep
function has been set (see Chapter 6)
(4) on system reset.
(5) any time the user's attention is required, such as at the end of a
calibration step.
-
37XXXD PM1-7
GPIB COMMUNICATIONGENERAL INFORMATION
1-5GPIB COMMUNICATIONThe following sections present a short summary of 37XXXD GPIB
communication. Subjects covered are program messages, separa
tor/termination characters,status reporting, and GPIB error condi
tions and corresponding 37XXXD responses. Refer to Chapter 7, Re
mote-Only Operation, for detailed description of these topics.
The primary GPIB messages that effect 37XXXD operation consist of
two major groups; Bus Interface Function messages, and Instrument
Specific messages.
-
-
-
Bus Interface
Function Messages
These are low level bus messages defined by IEEE 488.1. A discussion
of these messages is beyond the scope of this programming manual.
For further information, please refer to your GPIB controller documen
tation and/or to IEEE 488.1 Standards documents.Also refer to Ap
pendix A at the end of this Programming Manual for a brief primer on
the GPIB Interface.Table 1-1 summarizes some of the key Interface
Function Messages and the 37XXXD response to them.
Table 1-1. IEEE-488 Interface Function Messages
Interface Function
Message
DCL
SDC
GTLGo To LocalYesReturns the 37XXXD to local (front panel) control.
GETGroup Execute Trig-
IFCInterface ClearNoStops the 37XXXD GPIB from talking/listening.
LLOLocal LockoutNoDisables the front panel RETURN TO LOCAL key.
RENRemote EnableNoPlaces the 37XXXD in remote when addressed to listen.
Message Function
Device Clear
Selected Device
Clear
ger
Addressed
Command
No
Yes
YesExecutes a string of commands defined by the IEEE 488.2
Resets the 37XXXD GPIB communication functions.
Resets the 37XXXD GPIB communication functions.
common command *DDT. A GET is also done by using the
*TRG command (see Chapter 10, Command Dictionary).
37XXXD VNA Response
-
-
37XXXD Specific
Messages
The 37XXXD specific GPIB messages (also known as commands, que
ries, and mnemonics) are used to control 37XXXD front panel func
-
tions. They also provide for remote only operations such as data
transfers, status reporting and service request generation, error re
porting, and instrument-to-application program timing synchroniza
ence Guide; and Chapters 4-9 for information on all 37XXXD com
-
mands. The commands are organized both alphabetically and by
command function groups.There are many examples throughout this
manual to assist you in learning and using a desired command.
Most 37XXXD commands are three character contractions of their
functional descriptions.Examples include: OM1 (Output Marker 1),
1-837XXXD PM
GENERAL INFORMATIONGPIB COMMUNICATION
IFV (input Frequency List), TRS (Trigger Sweep), WFS (Wait for a
Full Sweep), OFD (Output Final [display format] Data), and PFS
(Print Full Screen).
Numeric parameter entry commands must be followed by a numeric
value. These commands can optionally accept a units or suffix termi
nator mnemonic. For example, SRT 2 GHZ (set start frequency to 2
GHz.)
Query commands,typically ending in a question mark (?), are used to
inquire about the state of a particular instrument function. Many
37XXXD setup commands have corresponding query commands listed
in the same section as the basic setup command. An example is the
MK1? query.It outputs the setting of Marker 1 Frequency,where the
MK1 command sets Marker 1 frequency.
IEEE 488.2 Common commands, which always start with the asterisk
character (*), are defined by the IEEE 488.2 Standard. They are used
to implement many standard instrument GPIB operations such as
querying when an operation completes, status reporting,self test, and
querying the instrument identification string. These commands are described throughout the Programming Manual in the specific funtional
group where they are used. A consolidated listing of these commands
can be found in Table 1-2, item 12 below and in Chapter 7. An example
IEEE 488.2 Common command is the *IDN? query (Output Instrument ID String.)
-
Separator
Characters
Terminator
Character
GPIB Error
Conditions
Separator characters are used to delimit program message elements
sent to or received from the 37XXXD. The permitted characters: semicolon (;), comma (,), and space ( ) and their usage is shown below.
CharacterUsed to separate
;
,
SpaceA command, its numerical entry value, and suffix mnemonic.
Multiple commands and multiple output response messages.
Multiple ASCII data elements for a single command.
The only allowed terminator character for 37XXXD GPIB messages is
the linefeed character (0A, decimal 10).
The 37XXXD responds to GPIB errors in the following manner:
q
A beep is issued.
q
An error message is displayed on the screen.
q
A bit is set in the Standard Event Status Register, and, if en
-
abled, an SRQ is generated.
37XXXD PM1-9
GPIB COMMUNICATIONGENERAL INFORMATION
An entry is written into the non-volatile Service Log describing
q
the error condition, along with time and date and, often, details
helpful in handling the error.When full, error entries at the bot
tom of the log are removed to make room for new entries.
If the error is GPIB related, the error message and the offending
q
program message, if applicable, can be output over the GPIB via
a query command. The previous error, if any, is also available via
another query.
The bits set in the Standard Event Status Register for GPIB errors are
as follows:
Bit 5 - Command Error (CME)
Invalid syntax, unrecognized command or command arguments,
separaters or terminators that do not conform to correct IEEEE 488.2
formats. The 37XXXD will ignore the remainder of commands in that
program message.
Bit 4 - Execution Error (EXE)
This bit is set if:
(1) A data entry parameter is out of range or not applicable.
(2) Action is impossible.
(3) Action is not possible in the current context or instrument state, or
if a required option is not fitted.
-
Testing the 37XXXD
GPIB Operation
Bit 3 - Device Dependent Error (DDE)
This bit is set if a valid requested action failed due to an instrument
specific error condition, such as attempting to access a bad floppy disk.
Bit 2 - Query Error (QYE)
This bit is set if the 37XXXD cannot provide the requested data. For
example, if an output is attempted when no data has been requested
or available,or if the output buffer is cleared due to sending more com
mands when data from a previous request has not yet been output.
Refer to Chapter 12, Error messages, for a listing of all 37XXXD error
messages (including GPIB errors).
The following test can be used to check your GPIB cable and 37XXXD
GPIB connectors.
1. Disconnect all GPIB cables from the 37XXXD.
2. Connect your GPIB cable between the two GPIB connectors on the
37XXXD rear panel.
3. Invoke the test from the front panel as follows: Option Menu key,
DIAGNOSTICS,PERIPHERAL TESTS,GPIB TEST.The test will
run for a few seconds, then report the result on the front panel dis
play.
-
-
1-1037XXXD PM
GENERAL INFORMATIONIEEE 488.2 SUMMARY
1-6IEEE 488.2 SUMMARYTable 1-2 provides answers to the “Device Documentation Require
ments” listed in the IEEE Standard 488.2-1992. It is also a good sum
mary of the GPIB operational characteristics of the 37XXXD.
Table 1-2. 37XXXD IEEE 488.2 Standard Documentation Summary (1 of 3)
2Device behavior when the user (unit) GPIB address
is set outside of the 0–30 range
3When is a user address change recognized?New address is accepted and entry color remains
4Description of settings at power-onThe front panel setup that was in effect prior to power
VNA returns an Out-of-Range error, issues an audible
beep, and the entry color on front panel menu display
is changed to red. Entered address is not accepted.
green.
down will be restored, except: the 37XXXD will be
taken out of hold if it was previously set. Periodic IF Cal
will be returned to timed operation.
Memories saved:
1. GPIB address
2. Internal hardware calibration data
3. Information reported via the *IDN? and *OPT?
queries.
4. Calibration coefficients
5. Normalized trace data
6. Stored front panel setups
Memories Cleared:
1. Service Request message.
2. Standard event status register (except the Power-On
bit is set)
3. Extended event status register
4. Limit pass/fail status register
5. Enable registers for items 2 thru 4, above.
6. GPIB input and output queues.
7. Trigger action for *TRG and GET reset to null.
Data Transfer:
1. Data transfer is reset to MSB first for
numerical array data transfers.
2. Data transfer format is reset to default, ASCII
mode (FMA) for numerical array transfers.
3. Data pair format for OFD/IFD/OM1-OM6 commands
is set to default (off) mode. (See command DPR0.)
Menu Displayed:
Setup Menu
-
-
37XXXD PM1-11
IEEE 488.2 SUMMARYGENERAL INFORMATION
Table 1-2. 37XXXD IEEE 488.2 Standard Documentation Summary (2 of 3)
NumberRequirement ItemImplementation in VNA
5Message exchange options
a. Size and behavior of input buffera. Default size = 3 KByte. Size increases to required
amount, as needed, for <Arbitrary Block> transfers.
b. Queries that return more than one <RESPONSE MESSAGE UNIT>
c. Queries that generate a response when parsedc. All
d. Queries that generate a response when readd. None
e. Commands that are couplede. None
6Functional elements used in construction of device-
specific commands.
For the <Indefinite Length Arbitrary Block> data ele
ments, the input buffer size for that element is
64 Kbyte. Attempting to program more data than
64 KByte will cause a loss of all data for that ele
ment. A DDE error message will be issued to indi
cate this condition. For <Definite Length Arbitrary
Block> data elements, an attempt is made to set the
buffer size for that element to the size indicated in
the header. If there is insufficient system memory
available at the time, all data for that element is lost.
A DDE error message will be issued to indicate this
condition.
b. None
See command descriptions.
-
-
-
7Buffer size limitations37XXXD Attempts to allocate amount required; sets
DDE error if not possible. (See 5a., above)
8<PROGRAM DATA> elements that may appear
within an <expression>
9Response syntax for queriesSee command descriptions.
10Description of device-to-device message transfer
traffic that does not follow the rules for <RESPONSE
MESSAGES>
11Size of block data responsesVariable, See command descriptions for details.
12IEEE.488.2 Common commands and queries that
are implemented
13State of VNA following the successful completion of
the Calibration query
14Maximum length of the block used to define the trig
ger macro (1.) The method of interpreting *TRG
within a *DDT command sequence (2.)
2. On execution, the 37XXXD returns a command error
and ignores the rest of the string.
1-1237XXXD PM
GENERAL INFORMATIONIEEE 488.2 SUMMARY
Table 1-2. 37XXXD IEEE 488.2 Standard Documentation Summary (3 of 3)
NumberRequirement ItemImplementation in VNA
15Maximum length and complexity of macro labels;
maximum length of block used to define a macro;
and how recursion is handled during macro expan
sion, if macro commands are implemented.
16Response to common query *IDN?.ANRITSU, <Model>, <SN>, <SW revision>
17Size of the protected user data storage area, if the
*PUD command or *PUD? query are implemented.
18Size of resource description, if the *RDT command
or *RDT? query are implemented.
19States affected by *RST, *LRN?, *RCL, and *SAV.*RST = default state (see Chapter 11),
20Scope of the self test performed by *TST? command.Fully automated internal hardware testing/reporting.
21Additional status data structures used in status re-
porting.
22Statement describing whether each command is
overlapped or sequential.
23Functional criteria that is met when an operation
complete message is generated in response to that
command.
N/A
-
N/A
N/A
*LRN, *RCL, *SAV not implemented
Failure results, if any, are written to the internal nonvolatile service log for user access.
Limits Event Status and Extended Event Status registers; refer to Chapter 7 for details.
All commands are sequential.
N/A – No overlapped commands.
24Descriptions used for infinity and not-a-number.N/A
37XXXD PM1-13/1-14
Chapter 2
GPIB and Ethernet
Programming Basics
Table of Contents
2-1INTRODUCTION .........................2-3
2-2EQUIPMENT AND CONFIGURATION .............2-3
Required Equipment.....................2-3
Configuration.........................2-4
2-3GPIB PROGRAM ELEMENTS ..................2-5
National Instruments GPIB Interface ...........2-5
Definitions ..........................2-5
2-4INITIALIZING THE GPIB ....................2-6
2-5SHUTTING DOWN THE GPIB SYSTEM ............2-6
2-6DETECTING GPIB ERRORS...................2-7
Full Error Detection .....................2-7
Limited Handling Error Detection .............2-7
NI488 Global Variables ...................2-7
Example ...........................2-7
2-7GPIB OPERATION TIME OUT..................2-8
Example ...........................2-8
2-8SENDING GPIB COMMANDS ..................2-9
Example: ...........................2-9
37XXXD Commands Used..................2-9
2-9RECEIVING GPIB DATA ....................2-10
Example: ..........................2-10
Error Handling:.......................2-10
37XXXD Commands Used .................2-11
Table of Contents (Continued)
2-10GPIB SRQ HANDLING .....................2-11
Calculating the Binary Weighted Bit Value........2-11
Enabling Service Request .................2-11
Example...........................2-11
Commands Used ......................2-12
NI488 RQ Functions ....................2-12
2-11COMPLETE GPIB OPERATIONS ...............2-13
Example 1..........................2-13
Example 2..........................2-13
37XXXD Commands Used .................2-14
2-12ETHERNET PROGRAMMING .................2-15
Ethernet and GPIB Differences ..............2-15
Ethernet Communication Steps ..............2-16
Example Program......................2-23
2-237XXXD PM
Chapter 2
GPIB and Ethernet
Programming Basics
2-1INTRODUCTIONThis chapter contains a brief introduction to GPIB and Ethernet
programming techniques and describes procedures to be used when
preparing programs for the 37XXXD VNA. It includes information
about equipment requirements and configuration for GPIB control of
the 37XXXD VNA, and many programming tips.
2-2EQUIPMENT AND
CONFIGURATION
Required EquipmentThe following equipment represents a minimum GPIB controllable
Familiarity with manual (front panel) operation of the 37XXXD is as
sumed. (Throughout this section, the 37XXXD VNA is referred to sim
ply as “37XXXD”.) A complete description of front panel operation is
contained in the appropriate 372XXD or 373XXD Vector Network Analyzer System Operation Manual.
The GPIB programming examples contained in this chapter assume
the equipment listed below is present and configured as described.
37XXXD VNA system:
q
A 37XXXD Vector Network Analyzer.
q
A computer/controller that supports the IEEE 488 GPIB stan
dard. The examples in this chapter address the IBM compatible
computers.
q
An IEEE-488 GPIB interface (built in, or add-in peripheral card)
with appropriate driver software. The National Instruments
GPIB IEEE-488.2 interface is assumed for all examples in this
chapter.
q
Appropriate software (any of the following):
·
Microsoft QuickBASIC, version 4.0 (or later)
·
Microsoft “C”, version 5.1 or later, or Quick C, version 2.5.
·
Any other programming language, or application software,
that supports the IEEE 488 GPIB interface (Pascal, Fortran,
etc.).
-
-
-
q
A GPIB cable (preferably 2 meters long).
37XXXD PM2-3
EQUIPMENT AND CONFIGURATIONGPIB PROGRAMMING BASICS
To:
IEEE 488.2 Interface
From:
IEEE 488.2 Interface
Connector
Figure 2-1. Model 37XXXD Shown Connected to an IEEE 488.2 Controller
The IBM PC and National Instruments GPIB interface
were chosen for demonstrating the 37XXXD GPIB operation in this manual. Any other GPIB controller that conforms to the IEEE 488 standard can be used to interface to
the 37XXXD.
Connector
NOTE
.
-
Channels
Measurement
Display
Enhancement
ConfigurationConfigure the 37XXXD as shown in Figure 2-1. Apply power to the
37XXXD and allow the system software to load from disk. Once the
software has finished loading and start-up testing is complete, the
37XXXD is ready to be remotely controlled via the GPIB. It is impor
tant to note that the 37XXXD will not respond to GPIB commands un
til the 37XXXD system software has been loaded.
-
-
Connect a GPIB cable from the computer/controller to the rear panel
Port2
F
U
S
E
E
S
U
F
U
F
S
E
IEEE 488.2 GPIB connector (left).
Apply power to the computer/controller and load the appropriate pro
-
gramming language software (QuickBASIC, “C”, etc.).
The default GPIB address for the 37XXXD (6) is assumed for all exam
-
ples in this chapter.
2-437XXXD PM
GPIB PROGRAMMING BASICSGPIB PROGRAM ELEMENTS
2-3GPIB PROGRAM
ELEMENTS
Instruments GPIB
National
Interface
The discussions in this chapter demonstrate basic GPIB programming
concepts that are typical elements of most GPIB application programs.
The controller used to demonstrate these concepts is the National In
struments 488.2 GPIB Interface which will be referred to as NI488
throughout this chapter.
NOTE
Regardless of the controller used, consult its documenta
tion and software distribution disks for complete details
and examples on setup and use of the controller's hard
ware and interface software functions.
Throughout this chapter references will be made to variables, con
stants, and controller function calls declared in the NI488 file that
your application uses to interface to the GPIB controller. This file is
decl.h for C and qbdecl.bas for QuickBASIC,and it must be in
cluded in your GPIB program. Consult your documentation for the
files used for other environments.
Including and compiling the appropriate NI488 file when preparing
your application is what allows use of the NI488 GPIB interface procedures and function calls in your program. Also, the file named
gpib.com must be installed in memory upon bootup of your computer. Typically, access to this file is through your system configuration
file (that is,config.sys for DOS based computers).
-
-
-
-
-
The gpib.com is what allows your GPIB program to physically interface to the installed GPIB controller and to execute GPIB function
calls during operation.
NOTE
Consult your controller's documentation for complete de
tails on software and hardware setup, test, and use prior to
proceeding with the following discussion. Knowledge of
your controller and its operation will be assumed from this
point forward.
DefinitionsThe following definitions apply for the remainder of this chapter:
q
board = 0, Active controller board number
q
address = 6, GPIB address of the instrument.
q
Address List = addresList, list of GPIB addresses terminated
with the NI488 constant NOADDR. For our examples the list con
sists of two elements (6, NOADDR).
-
-
37XXXD PM2-5
INITIALIZING THE GPIBGPIB PROGRAMMING BASICS
2-4INITIALIZING THE GPIBInitializing is the process of directing your controller to take control of
the bus (become CIC — Controller In Charge) and setting the GPIB
software to initial default settings.
NOTE
Default initial installation configuration is assumed for
the NI488 hardware and software.
2-5SHUTTING DOWN THE
GPIB SYSTEM
NI488 does this by sending an interface clear to the desired board us
ing:
SendIFC(board)
The board will become CACS (Active controller). NI488 software al
lows use of up to 4 controllers. The board specified by the SendIFC()
function must be designated CIC – Controller In Charge in its setup
and configuration. See NI488 config utility in NI488 documentation.
SendIFC() is also useful anytime you want to insure that your GPIB
controller has control over the bus, the GPIB software is in its default
parameters, and GPIB of all instruments on the bus is cleared and in
idle state.
The following NI488 functions are also useful when initializing your
application.
q
To place all instruments in remote state,use:
EnableRemote(board, addressList)
q
To clear GPIB operation of all instruments use:
DevClearList(board, addressList)
An important step in quitting a GPIB application is to shut down the
GPIB interface. For the NI488 this is done by
q
Insuring that you have control over the bus.
-
-
q
Clearing all instruments' GPIB and placing them in an idle state.
q
Releasing the controller GPIB software and hardware.
Implement the above by sending:
SendIFC(board)
ibonl(board, 0)
2-637XXXD PM
GPIB PROGRAMMING BASICSDETECTING GPIB ERRORS
2-6DETECTING GPIB
ERRORS
Full Error DetectionFull error detection and handling is an invaluable debugging tool that
Limited Handling
Error Detection
NI488 Global
Variables
It is important to use error checking code throughout your application
program. Error checking usually does not significantly impact the
speed of a GPIB application. This is because the GPIB bus operations
are I/O operations whose execution time depends on a handshake pro
cess. This process is typically much slower than executing (error
checking) code in your computer's memory.
should be used to its fullest during development of your application.
Error detection with at least a limited amount of handling should be
used after each GPIB I/O operation in your final program. This will in
sure predictable operation of your application, proper system control,
and accurate data processing.
The NI488 interface maintains three global variables useful in deter
mining correct GPIB operations. These variables are updated after,
and reflect the condition of, the last GPIB call to the interface. The
variables are:
IBSTA
q
This variable provides the latest bus activity status; that is,errors, completions, time outs, etc.
q IBERR
This variable provides information on the type of error, if an error
was reported in IBSTA.
-
-
-
q
IBCNT/IBCNTL
The number of data bytes transferred on the bus in the last operation. IBCNTL is the “long integer” version of IBCNT.
ExampleError checking for the NI488 interface is as follows. After each GPIB
call, the IBSTA is checked for errors using the NI488 declared con
stant EERR - in BASIC, or ERR in C. If true, the gpiberr() function is
called to decode and display the global variables IBSTA, IBERR, and
IBCNT. For example,for QuickBASIC,the following code is inserted af
ter a GPIB call:
IF IBSTA% AND EERR THEN
CALL gpiberr (error during GPIB operation)
END IF
NOTE
The NI488 disks and documentation contain the source
listing of the gpiberr() function. This function should be
copied into your code and used after each GPIB function
call. Use the example programs provided on the NI488 dis
tribution disks.Note that gpiberr() can also be modified
to fit a particular application's requirements.
-
-
-
37XXXD PM2-7
GPIB OPERATION TIME OUTGPIB PROGRAMMING BASICS
2-7GPIB OPERATION
TIME OUT
Setting GPIB time out is necessary to allow for lengthy instrument op
erations to complete before the application program continues with its
processing. (Refer to section 2-1, Waiting for Instrument Operations to
Complete.)
ExampleThe NI488 time out is set using the ibtmo() interface call, as follows:
ibtmo(instrument_handle, timeout_setting)
Where:
instrument_handle = The value returned by the ibfind() or
q
ibdev() interface call for the instrument.
timeout_setting = A value that disables or sets the time out
q
setting. NI488 uses declared constants to represent the allowable
time out settings,for example, the T100s constant is 100 seconds,
T30ms is 30 milliseconds, TNone is 0, etc. The complete list is in
the NI488 include file for your language (qbdecl.bas, decl.h).
NOTE
Consult NI488 documentation and distribution disks for
information and an example on using ibtmo(),
ifbind(), and ibdev().
-
2-837XXXD PM
GPIB PROGRAMMING BASICSSENDING GPIB COMMANDS
2-8SENDING GPIB
COMMANDS
GPIB controllers provide for sending GPIB commands to an instru
ment (or the controller itself if its address is used). The NI488 uses
several commands,the most common is:
Send (board, address, buffer, numBytes, eot_mode)
Where:
board, address = see section 2-3 for definitions.
q
buffer = String of one or more instrument specific GPIB com
q
mands from the defined list in the instrument's GPIB documenta
tion.
buffer = String of one or more instrument specific GPIB com
q
mands from the defined list in the instrument's GPIB documenta
tion.
numBytes = The number of bytes contained in the buffer.
q
eot_mode = The method used to signal end of transmission. This
q
is typically done using ASCII linefeed character 0A hex (10 decimal) and then setting EOI state (end of transmission) on the bus.
The NI488 defines the following constants for use to setup end of
transmission methods:
n NLend - Linefeed with EOI
n
DABend - EOI only
n
NULLend -Do nothing to mark end of transmission
-
-
-
-
-
Example:Send the 37XXXD at address 6, the commands “CH2;DSP;MAG”, from
37XXXD Commands
Used
controller number 0, using the linefeed with EOI to mark the end of
transmission:
Send (0, 6, “CH2;DSP;MAG”,11,NLend)
The above example uses the following commands defined in the
37XXXD command set:
CH2 - sets active channel to 2,
DSP - displays only the active channel on the
whole screen,
MAG - displays the active channel's data in log
magnitude format (dB).
NOTE
The semicolon (;) is used to separate the different com
-
mands.
37XXXD PM2-9
RECEIVING GPIB DATAGPIB PROGRAMMING BASICS
2-9RECEIVING GPIB DATAIn order to receive data from an instrument over the GPIB, you must
first instruct the instrument to output the desired data. You do this by
using one of the instrument's defined data output commands and the
controller Send() function (see section 2-8, “Sending commands”).
The instrument must then be given permission to start sending data
(talk). The NI488 call to do this is:
Receive(board, address, buffer, numBytes,
eod_mode)
Where:
board, address = see section 2-3 for definitions.
q
buffer = The name of the memory address of the buffer where
q
the received data is to be placed. Typically this is an array of type
characters (a string). Although, for binary data transfers, the
NI488 software will accept an array of almost any type; that is.
integer, floating point, etc.
numBytes = The maximum number of bytes to read from the in-
q
strument. Insure that “buffer” above is of at least this size.
eod_mode = The method used to signal the controller to stop re-
q
ceiving data. Typically the NI488 constant STOPend is used (EOI
state – end of transmission – set with the last byte). If you want
to stop receiving when a certain transmission terminator character is received, then use the hex value of that character instead of
the STOPend.
Example:Use the NI488 controller number 0, to send the 37XXXD at address 6,
the command “ONP” using the line feed with EOI to mark end of
transmission:
Send(0, 6, “ONP”, 3, NLend)
Upon receiving a data output command, the 37XXXD will prepare the
data requested and wait for the controller to put it in the talk state so
it can put the data out on the bus. This is done by:
numBytes = 20
Receive(0, 6, buffer, numBytes, STOPend)
Error Handling:The number of bytes actually sent on the bus can now be retrieved
from the NI488 interface software by immediately storing the value of
the IBCNT global variable in a program variable as follows:
actualReceivedBytes = IBCNT
2-1037XXXD PM
GPIB PROGRAMMING BASICSGPIB SRQ HANDLING
37XXXD Commands
Used
If we expected an exact number of bytes to be received, we can com
pare the requested number of bytes “numBytes” with the actual re
ceived “actualReceievedBytes” and take some corrective action if they
do not match. You should do this before continuing to the data process
ing section of the program:
If numBytes ISNOTEQUALTO actualReceivedBytes then
Call gpiberr(”incorrect number of bytes
received”)
END IF
NOTE
Consult your programming language syntax for the opera
tor used to check in-equality, to use in place of ISNOTE
QUALTO.
The above example uses the following commands defined in the
37XXXD command set:
ONP – Outputs the number of data points in the current sweep. It
q
will output the number represented in ASCII format.
-
-
-
-
2-10GPIB SRQ HANDLINGControllers use a dedicated line on the GPIB to detect if an instrument
has requested service.An instrument sets this line when a predetermined set of conditions inside it have been met. These conditions are
selected and programmed into the instrument by setting the Service
Request Enable Register to a decimal value that corresponds to the bit
values which, when true, will generate an SRQ. This is a binary
weighted decimal value in the range 0 – 255.
-
Value
-
The decimal value of a bit in a register is equal to the number 2 raised
to a power equal to the bit number. For example, the decimal value of
bit 4 in the Service Request Enable Register is 2 raised to the power 4
which is: 2
To enable service request in the 37XXXD,use the command *SRE Service Request Enable,with the desired value.
when it has data to send, then output the number of points in the cur
rent sweep. We need to enable bit 4 (MAV), Message Available, in the
Service Request Enable Register,so a service request will be gener
ated when the data is ready. The decimal value of bit 4 is 16 (2
The NI488 Send() function is used to send the 37XXXD at address 6,
the commands “*SRE 16;ONP” (12 ASCII bytes), from controller num
ber 0, using the linefeed with EOI to mark end of transmission:
4
= 16. Similarly, the decimal value of bit 0 is: 20=1.
Send(0, 6, “*SRE 16;ONP”, 12, NLend)”
4
= 16).
-
Calculating the Bi
nary Weighted Bit
Enabling Service
Request
ExampleCommand the 37XXXD to request service; that is,generate an SRQ,
37XXXD PM2-11
-
-
GPIB SRQ HANDLINGGPIB PROGRAMMING BASICS
Commands UsedThe above example uses the following commands defined in the
37XXXD command set:
*SRE –Sends a Status Request Enable mask.
ONP –Outputs the number of sweep points.
NI488 RQ FunctionsThe following NI488 functions are useful in handling SRQ operations.
Consult your NI488 documentation for full details.
To test for occurrence of SRQ:
q
TestSRQ(board, SRQset)
Where:
SRQset contains 1 if SRQ is set, or 0 if it is not.
·
To wait for occurrence of SRQ and report if it was set:
q
WaitSRQ(board, SRQset)
Where:
·SRQset contains 1 if SRQ was set within the time out allowed, or 0 if it was not. (See section 2-8, Setting GPIB Operation Time Out.)
q To find out which instrument is requesting service (set SRQ), in-
struct the controller to perform a serial poll and return the
results as follows:
FindRQS(board, addressList, statusByte)
Where:
·
statusByte = The status byte of the first requester found
is returned in this variable.
·
The index in addressList that contains the address of the
instrument requesting service is returned in the IBCNT
global variable.
q
To read out the SRQ byte from an instrument:
ReadStatusByte(board, address, statusByte)
q
To parallel poll, see the following functions in the NI488 docu
-
mentation.
PPoll()
PPollConfig()
PPollUnconfig()
2-1237XXXD PM
GPIB PROGRAMMING BASICSCOMPLETE GPIB OPERATIONS
2-11COMPLETE GPIB
OPERATIONS
Example 1Command the 37XXXD to perform a sweep and hold then place an
Instruments often require a period of time to complete certain opera
tions such as disk I/O, measurement sweep, data preparation, etc..
Your application program must allow the instrument time to complete
these operations and be able to detect when operations are completed.
The simplest mechanism for synchronizing operations over the GPIB
involve using the *OPC? -Operation Complete query and the *OPC Operation Complete command.
ASCII “1" in its output buffer (*OPC?) when done.
The NI488 Send() function is used to send the 37XXXD at address 6,
the commands,”HLD;TRS;WFS;*OPC?”, from controller number 0,
using the linefeed with EOI to mark end of transmission. The Receive() function is then used to hold the program from continuing
processing until it receives the output of the *OPC command (or
times out):
buffer = “HLD;TRS;WFS;*OPC?”
Send(0, 6, buffer, 17, NLend)
oneByte = 1
Receive(0, 6, buffer, oneByte, STOPend)
-
-
NOTE
The time out must be set high enough to allow the sweep
to complete (see “Setting time outs” in section 2-8).
Example 2Now we will modify the above example to request service when bit 4
(MAV) in the Status Byte Register is set (*SRE 16) to let the program
know when the *OPC? data is ready to be output. This overcomes the
time out problem but it does increase program complexity.
buffer = “*SRE 16;HLD;TRS;WFS;*OPC?”
Send(0, 6, buffer, 25, NLend)
SRQset = 0
WHILE (SRQset = 0)
WaitSRQ(board, SRQset)
ReadStatusByte(board, address, statusByte)
oneByte = 1
Receive(0, 6, buffer, oneByte, STOPend)
NOTE
TestSRQ() can be used instead of WaitSRQ() to check
for the occurrence of SRQ in the WHILE loop. This would
allow your program to perform other tasks while waiting
for SRQ inside the WHILE loop.
37XXXD PM2-13
COMPLETE GPIB OPERATIONSGPIB PROGRAMMING BASICS
37XXXD Commands
Used
Examples 1 and 2 above used the following commands defined in the
37XXXD command set:
*SRE - sends a Status Request Enable value.
HLD - places VNA into hold mode
TRS - triggers a sweep. Since the VNA is already
in hold mode, the hold mode is changed to
single sweep and hold.
WFS - waits one full sweep and stops
*OPC? - outputs an ASCII “1” when operation is
complete
NOTE
Refer to Chapter 7, Remote Only Operations for more in
formation and examples on status reporting and service
request generation.
-
2-1437XXXD PM
GPIB PROGRAMMING BASICSETHERNET PROGRAMMING
2-12ETHERNET
PROGRAMMING
Ethernet and GPIB
Differences
The syntax of programming the Lightning D Series VNA over the
Ethernet is the same as the syntax of programming the VNA over the
GPIB.Most of the commands supported over GPIB are supported over
the Ethernet and the data returned from queries is in the same format
as that of the GPIB.
During communication over the GPIB, the start and end of a program
message are well defined and important. On reception of a program
message, the VNA does nothing until the message has been completely
received (an end message indicator is detected). With TCP/IP
communication, the concept of the end of a message is somewhat
blurred. Consider what happens when you receive a Web page over the
Internet. The reception of a Web page takes place over a period of time
where different elements are received until the viewer is unable to
perceive any further change.
Because all Anritsu VNAs assert the EOI line at the end of a program
message during GPIB data transfer,a user can receive GPIB data as
rapidly as is possible until the EOI signal is detected. Ethernet
communications has no such thing as an EOI line; therefore, the user
must employ some other mechanisms to find the end of a program
message. IEEE488.2 provides just such a mechanism by allowing the
instrument receiving the data to discover the end of the program
message by either scanning for the end message byte during reception
of ASCII data, and/or utilizing the byte count in arbitrary block
headers during binary data transfer.
NOTE
The Arbitrary Length Arbitrary Block header format of
IEEE488.2 requires the EOI signal; therefore, this form of
arbitrary block cannot be used with TCP/IP
communication. Anritsu VNAs do not send this type of
arbitrary block, so reception of VNA data is not affected by
this issue.
A GPIB device does not send data out without first being addressed to
talk, and the data transfer mode set. Over TCP/IP, there is no waiting
to be addressed to talk. The VNA has no idea whether the controller is
actually listening or not. The data is just simply sent out whenever it
appears in the output routine.
37XXXD PM2-15
ETHERNET PROGRAMMINGGPIB PROGRAMMING BASICS
A technique commonly used to measure the bus transfer speed was to
command the VNA to output Bitmap image data, or some other large
piece of data, and then wait several seconds to insure that the data
had been completely generated and ready to go. Then the controller
would read the data in as fast as possible while keeping track of the
elapsed time. This technique does not work at all over TCP/IP because
the data comes out whether the controller is reading or not. What
would happen is that the communications channel would be hopelessly
blocked with individual messages bouncing back and forth over the
Ethernet in a flurry of activity, finally dying out when their transfer
timeout occurred. To prevent this, The controller should start listening
for data as soon as it is done sending the query message.
IEEE488.2 specifies that all output data is thrown away when a new
program message is received before the previously generated data is
read completely.The embedded operating system employed in the
VNA does not provide a mechanism to throw away TCP/IP data that
has been buffered up to be output, short of closing the socket. Of
course, if the VNA is receiving data on the socket, closing the socket is
not a good idea. Therefore, the data is allowed to linger and will be
available until it is completely read out.
Ethernet
Communication Steps
If the VNA input routine has to wait long periods of time without
receiving any commands,it will periodically transmit a null byte to
test if the connection is still alive. This can cause several leading null
bytes in the VNA data. Leading null bytes are known as WHITE space
and are permitted in a 488.2 response. So,when receiving data, be
sure to check for the leading null characters.
In order to communicate over the Ethernet using TCP/IP and the
Winsock dll, a program must perform the following steps:
1 - Load the Winsock dll at the start of the program
2 - Create a local socket for Ethernet communication using the TCP
protocol
3 - Connect the local socket to the VNA
4 - Write commands to the VNA and Read data back as necessary
5 - Close the local socket when done
6 - Unload the Winsock dll at the end of the program
An example program etherapp.cpp is included at the end of the
chapter; we will be discussing the important parts of it in this section.
2-1637XXXD PM
GPIB PROGRAMMING BASICSETHERNET PROGRAMMING
Step 1.Load the Winsock dll at the start of the program.
The Winsock library includes a function that loads the dll. The version
must be specified when the call is made. The code that loads Winsock
2.2 is shown below:
// Load Winsock
//
status = TRUE;
winsockok = TRUE;
if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
{
printf("Failed to load Winsock library!\n");
status = FALSE;
winsockok = FALSE;
}
Where:
wsd is a WSADATA structure. The structure is unimportant to us
since it is only referenced when the Winsock dll is loaded and nowhere
else in the program. Notice there are 2 flags associated with loading
the dll.
status is a variable that starts out with the value TRUE. If anything
goes wrong,it is set FALSE.The intent of status is to bypass any
subsequent program operations,seemingly to cause the program to
immediately exit.
winsockok is a variable that starts out TRUE, but if the dll loading
fails for some reason, it is nice to know when it comes time to unload
the dll.
37XXXD PM2-17
ETHERNET PROGRAMMINGGPIB PROGRAMMING BASICS
Step 2.Create a local socket for Ethernet communication using the TCP
protocol.
The socket is created using the function socket() which returns the
socket handle sock. If the value of sock is INVALID_SOCKET the
function call failed. We should not try to access this socket value.Use
the variable status to prevent any further access.
// Create the socket
//
if (status == TRUE)
{
sock = socket(AF_INET, SOCK_STREAM,IPPROTO_TCP);
if (sock == INVALID_SOCKET)
{
printf("socket() failed: %d\n",
WSAGetLastError());
status = FALSE;
}
}
NOTE
Do not try to create the socket if the status is FALSE.If we
fail to create the socket, we set the status as FALSE.
SOCK_STREAM is the type of socket used with TCP and
IPPROTO_TCP is the protocol used with TCP.The
argument AF_INET is always used regardless.
2-1837XXXD PM
GPIB PROGRAMMING BASICSETHERNET PROGRAMMING
Step 3.Connect the local socket to the VNA.
This step is actually two steps. The first is to send the connection
request to the VNA using the function connect(), as follows:
// Connect to the VNA
//
if (status == TRUE)
{
// Set up the VNA address first
// The port number is always 5000
The second part of the connect is to get the VNA acceptance status
back from the VNA.
NOTE
We must look at the return code for the function call recv()
to see if it failed. If that is OK, we have to check if the
VNA refused the connection. Lightning has two available
sockets it can assign. If both of those are in use by
someone else. The acceptance message will be:
000 Connection refused
37XXXD PM2-19
ETHERNET PROGRAMMINGGPIB PROGRAMMING BASICS
The following example shows how to get the VNA acceptance status
back from the VNA:
// Get the connection OK from the VNA
// will be one message as below
// 100 Connection accepted - 23 bytes
// 000 Connection refused - 22 bytes
if (status == TRUE)
{
ret = recv(sock, idn_buff, sizeof(idn_buff), 0);
if (ret == SOCKET_ERROR)
{
printf("recv() failed: %d\n",
WSAGetLastError());
status = FALSE;
}
// Test if connection is accepted
else
{
// Print out response
idn_buff[ret] = 0;
printf("%s\n", idn_buff);
// Set flags
if (strncmp(idn_buff, "100 Connection accepted",
23) != 0)
status = FALSE;
}
}
2-2037XXXD PM
GPIB PROGRAMMING BASICSETHERNET PROGRAMMING
Step 4.Write the commands to the VNA and read back the data as necessary.
For this particular example there are also two steps, to send a
command and to receive an ASCII response back.
// Send the query
//
if (status == TRUE)
{
sprintf(say_buff, " %s \n", message);
ret = send(sock, say_buff, strlen(say_buff), 0);
if (ret == SOCKET_ERROR)
{
It is a little more complex since we have to loop until a line
feed is received. This is the clue that an ASCII response is
complete. Notice at the lower section where the response is
printed, leading nulls are skipped over. As mentioned
earlier, the receive code may be sending these periodically.
done_flag = TRUE;
// Overwrite the line feed at the end
*end_ptr = 0;
}
}
}
// If we received something print it out
if (status == TRUE)
{
// Bump over any leading nulls
aux_ptr = idn_buff;
while(*aux_ptr == 0) aux_ptr++;
// Print out the ltrimmed string
printf("RECV [%d bytes]: '%s'\n", byte_count,
aux_ptr);
}
}
2-2237XXXD PM
GPIB PROGRAMMING BASICSETHERNET PROGRAMMING
Step 5.Close the local socket when done.
Closing the socket is very important. If you close the socket, it will be
detected almost immediately by the VNA, any lingering data is
cleared, and the memory is returned to the memory pool. More
importantly,the socket will be closed making it available for another
connection later.Lightning only has two sockets it can use to connect.
If these sockets are not closed, communication will come to a
screeching halt. Eventually, a VNA socket will be closed when the
receive code sends a null byte, but this normally takes several seconds.
Be sure to CLOSE THE SOCKET when you are done with it. It is good
programming practice to take care of loose ends before closing a
program.
// Close the socket if it was created
if (sock != INVALID_SOCKET) closesocket(sock);
Step 6.Unload the Winsock dll at the end of the program.
This is another one of those loose ends that you must take care of.If
the Winsock dll is not unloaded, it leaves a process still running, even
though the program has terminated. In most cases, this running
process will not permit a new instance of the program, evidenced by
clicking on the program and nothing happening. Be sure to UNLOAD
THE WINSOCK DLL when you are done with it.
// Unload the Winsock dll if it was loaded
if (winsockok == TRUE) WSACleanup();
Example ProgramUnlike all those example Winsock TCP/IP programs you find on the
internet, this program was specifically written for a Lightning VNA
using Microsoft Visual Studio 6.0. You might want to try it and see
how easy it is to write TCP/IP applications.
This is a console program. You can open a DOS window, change to the
directory where you have the program and type:
etherapp onp;oid 172.26.208.126
If the device whose address is 172.26.208.126 is a VNA, you will get
something similar to the following displayed on the screen:
// Etherapp.cpp
// A simple console application that performs sends a
// query command to the vna and gets the response back
// Be sure to link this with the library ws2_32.lib
// winsock2.h is part of windows
#include <winsock2.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define TRUE1
#define FALSE0
int main(int argc, char **argv)
{
short status;
short winsockok;
short done_flag;
WSADATA wsd;
SOCKET sock;
int ret;
int byte_count;
unsigned short Port;
struct sockaddr_in vna;
char ipaddr[32];
char message[128];
char say_buff[256];
char idn_buff[256];
char *aux_ptr;
char *end_ptr;
// The query command we will be sending
//
Port = 5000;
// Take the query from the command line
//
if (argc > 1) strcpy(message, argv[1]);
else strcpy(message, "*IDN?");
// Take the vna ip address from the command line
//
2-2437XXXD PM
GPIB PROGRAMMING BASICSETHERNET PROGRAMMING
if (argc > 2) strcpy(ipaddr, argv[2]);
else strcpy(ipaddr, "172.26.208.131");
// Load Winsock
//
status = TRUE;
winsockok = TRUE;
if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
{
printf("Failed to load Winsock library!\n");
status = FALSE;
winsockok = FALSE;
}
// Create the socket, and attempt to connect to the server
//
if (status == TRUE)
{
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock == INVALID_SOCKET)
{
printf("socket() failed: %d\n", WSAGetLastError());
status = FALSE;
}
}
// Connect to the VNA
//
if (status == TRUE)
{
// Set up the VNA address first
//
vna.sin_family = AF_INET;
vna.sin_port = htons(Port);
vna.sin_addr.s_addr = inet_addr(ipaddr);
// Now connect
//
if (connect(sock, (struct sockaddr *)&vna, sizeof(vna)) == SOCKET_ERROR)
{
printf("connect() failed: %d\n", WSAGetLastError());
status = FALSE;
37XXXD PM2-25
ETHERNET PROGRAMMINGGPIB PROGRAMMING BASICS
}
// Get the connection OK from the VNA
// will be one message as below
// 100 Connection accepted - 23 bytes
// 000 Connection refused - 22 bytes
if (status == TRUE)
{
ret = recv(sock, idn_buff, sizeof(idn_buff), 0);
if (ret == SOCKET_ERROR)
{
printf("recv() failed: %d\n", WSAGetLastError());
status = FALSE;
}
// Test if connection is accepted
else
{
// Print out response
idn_buff[ret] = 0;
printf("%s\n", idn_buff);
// Set flags
if (strncmp(idn_buff, "100 Connection accepted", 23) != 0)
ret = recv(sock, aux_ptr, sizeof(idn_buff), 0);
if (ret == SOCKET_ERROR)
{
printf("recv() failed: %d\n", WSAGetLastError());
status = FALSE;
}
else
{
// Do a test for the line feed at the end
aux_ptr[ret] = 0;
end_ptr = strchr(aux_ptr, (int)'\n');
// Bump up to the end of the received stuff
// Update the running byte count
aux_ptr += ret;
byte_count += ret;
// If a line feed was found, we are done
if (end_ptr != NULL)
{
done_flag = TRUE;
// Overwrite the line feed at the end
*end_ptr = 0;
}
}
}
// If we received something print it out
if (status == TRUE)
{
// Bump over any leading nulls
aux_ptr = idn_buff;
37XXXD PM2-27
ETHERNET PROGRAMMINGGPIB PROGRAMMING BASICS
while(*aux_ptr == 0) aux_ptr++;
// Print out the ltrimmed string
printf("RECV [%d bytes]: '%s'\n", byte_count, aux_ptr);
}
}
// Close the socket if it was created
if (sock != INVALID_SOCKET) closesocket(sock);
// Unload the Winsock dll if it was loaded
if (winsockok == TRUE) WSACleanup();
return 0;
}
2-2837XXXD PM
Chapter 3
Series 37XXXD
Programming Examples
Table of Contents
3-1INTRODUCTION .........................3-3
3-237XXXD PROGRAMMING EXAMPLES .............3-3
3-3EXAMPLE 1 ............................3-4
3-4EXAMPLE 2 ............................3-6
3-5EXAMPLE 3 ............................3-8
3-6EXAMPLE 4 ...........................3-10
3-7EXAMPLE 5 ...........................3-11
3-8EXAMPLE PROCEDURE 1 ...................3-12
3-9EXAMPLE FUNCTION 1 ....................3-13
3-10EXAMPLE PROCEDURE 2 ...................3-14
Chapter 3
Series 37XXXD
Programming Examples
3-1INTRODUCTIONThis chapter contains example programs to familiarize the user with
37XXXD programming.Familiarity with manual (front panel) opera
tion of the 37XXXD is assumed. Throughout this section, the 37XXXD
VNA is referred to simply as “37XXXD.”A complete description of
front panel operation is contained in the 37XXXD Vector Network An
alyzer System Operation Manual.
-
-
3-237XXXD PROGRAMMING
EXAMPLES
Also, it is assumed that you have read Chapters 1 and 2 and are famil
iar with the information they contain. This information describes the
various syntax and functions used in the example sequences presented
throughout the chapter.This includes: Send, Receive, IBCNT,IBERR,
ISNOTEQUALTO,and others.
The main sequences for five example 37XXXD programs are listed and
explained in the following pages. In these examples, the NI488 function calls are abbreviated; refer to Chapter 2 and the NI488 documentation for full details. Refer to the 37XXXD Command Function groups
and the Command listings in this manual for complete details on
37XXXD command operations.
NOTE
The functions and procedures called from the example se
quences in sections 3-3 through 3-7 are provided at the
end of this chapter in sections 3-8 through 3-10.
The intent of these example program sequences is to provide algo
rithms useful when programming various features of the 37XXXD. You
are encouraged to study these algorithms, copy them into your pro
gramming environment, and tailor them for your language and appli
cation.
-
-
-
-
-
37XXXD PM3-3
EXAMPLE 1PROGRAMMING EXAMPLES
3-3EXAMPLE 1This example sequence lists and explains some common 37XXXD oper
Program variables instrSetup and sizeInstrSetup will
be used later with the IFP command to input the
saved setup string.
n
Read sweep frequencies
-
q
Trigger and wait for full sweep then hold
Send (0,6,“HLD;TRS;WFS”,NLend)
q
Wait for operations to complete (See “Wait for Instr()” example,
page 3-12.)
WaitForInstr()
q
Request sweep frequencies (OFV):
Use floating point (64 bit) binary format (FMB), Least Signifi
cant Byte first ordering (LSB for IBM/compatible PCs only).
Send (0,6,“LSB;FMB;OFV”,NLend)
q
Get number of bytes to read:
See Chapter 7, “Data Transfer” section for details on <Arbi
trary Block> data transfers and structure of the header used to
precede and give number of bytes in data block. (See “Get
NumBytes( )” example, page 3-13.)
numBytes = GetNumBytes(address, headerString)
q
Read frequencies
freqArray is a floating point double precision array of up to
1601 elements.
Receive(freqArray, numBytes, STOPend)
-
-
-
3-437XXXD PM
PROGRAMMING EXAMPLESEXAMPLE 1
Check for complete transfer
q
if (numBytes ISNOTEQUALTO IBCNT then
gpiberr(“Could not read freq list correctly”)
Reset instrument
n
Send reset command
q
Send (0,6,“*RST”,NLend)
Wait for operations to complete (page 3-12)
q
WaitForInstr()
Download and restore a previously saved setup
n
Command instrument to receive a setup string. Use
q
“NULLend” (see Chapter 2, section 2-9.)
Send (0,6,“IFP ”,NLend)
NOTE
The space after the IFP command is needed to separate it from the setup string, which follows.
Send the setup string. Use “NLend” (see Chapter 2, section
q
2-9.)
Send (0,6,(instrSetup, sizeInstrSetup),NLend)
q
Check if all data was sent correctly
if (sizeInstrSetup ISNOTEQUALTO IBCNT then
gpiberr(“Error sending setup string”)
n
Select instrument Marker 1 active
Send (0,6,“MR1”,NLend)
n
Read measurement trace
q
Trigger and wait for full sweep then hold
Send (0,6,“TRS;WFS;HLD”,NLend)
q
Wait for operations to complete (page 3-12)
WaitForInstr()
q
Request trace data:
in final trace graph type values (OFD), in floating point (32
bit) binary format (FMC). Use Least significant Byte first or
dering (LSB, for IBM/compatible PCs only)
Send (0,6,“LSB;FMC;OFD”,NLend)
-
37XXXD PM3-5
EXAMPLE 2PROGRAMMING EXAMPLES
Get number of bytes to read (page 3-13)
q
numBytes = GetNumBytes
Read out the trace data values.
q
Receive(traceData, numBytes, STOPend)
Check if all data was transferred
q
if (numBytes ISNOTEQUALTO IBCNT then
gpiberr(“Could not receive data.”)
Calculate number of sweep points in data string
q
POINTSIZE is 8 bytes for data transfers using the FMB for
mat and 4 bytes if using the FMC format. See Chapter 7,
“Data Transfer Commands.”
numFreqs = numBytes / POINTSIZE
Put instrument(s) in local to allow use of front panel
n
EnableLocal(board, addressList)
-
3-4EXAMPLE 2This example sequence lists and explains 37XXXD commands used for
automated 12 Term Calibration.
Display instructions to operator on computer screen
To connect THRU LINE between Ports 1 and 2 and wait for him.
PRINT “Connect THRU LINE between
PRINT “Press ENTER when ready”
Ports 1 and 2"
Measure thruline (page 3-12).
q
TakeCalData()
q
Read Calibration Coefficient Data from instrument and store
the 488.2 data transfer header which is useful for sending the
same size data array back to the 37XXXD later. Also calculate
and store the number of frequency points read in.
q
Request the error term/coefficient array (OC1) in 64 bit Float
ing Point format (FMB), Least Significant Byte order (LSB, for
PCs only). See Chapter 7, “Data Transfer Commands” for the
error terms returned by the OCx series commands.
Send (0,6,“LSB;FMB;OC1”,NLend)
q
Get number of bytes contained in the data string and store the
header read from the 37XXXD into calHeader (string of charac
ters). See GetNumBytes(), page 3-13.
numBytes = GetNumBytes(address, calHeader)
q
Read calibration data values
calData is an 82 element double precision floating point array.
Receive(calData, numBytes, STOPend)
-
-
3-837XXXD PM
PROGRAMMING EXAMPLESEXAMPLE 3
Check if all data was transferred
q
if (numBytes ISNOTEQUALTO IBCNT) then
gpiberr(“Could not receive data.”)
Store number of calibration data bytes transferred
q
calDataSize = IBCNT
Calculate number of frequency points in the data trace if de
q
sired. POINTSIZE is 8 bytes for data transfer using the FMB
format. See Chapter 7, “Data Transfer Commands.” The divi
sion by two is because each data point represents a complex
data pair (real, imaginary).
numFreqs = (CalDataSize / 2) / POINTSIZE
Send Calibration Coefficient Data to instrument
n
Simulate a Transmission Calibration
q
Command the 37XXXD to apply transmission calibration coef
ficients to data (AFT), then input the calibration coefficient ar
ray for transmission error term (IC1), in 64 bit Floating Point
format (FMB), Least Significant Byte order (LSB, for use with
PCs only). Use “NULLend” (see Chapter 2, section 2-9.)
Send (0,6,“AFT;LSB;FMB;IC1”,NLend)
-
-
-
-
NOTE
Note the space after the IC1 command; it is needed to
separate it from the calibration coefficient data array,
which follows.
q
Send cal coefficient #1 data transfer header (same one that was
received from the OC1 transfer). Use “NULLend” (see Chapter
2, section 2-9.)
Consult your compiler documentation for a function
that returns length of a string.
q
Check for proper transfer
if (CalHeaderSize ISNOTEQUALTO IBCNT) then
gpiberr(“Data not sent properly”
q
Send cal coefficient #1 data. Use “NLend” (see Chapter 2, sec
)
tion 2-9.)
Send (0,6,(calData, calDataSize),NLend)
-
37XXXD PM3-9
EXAMPLE 4PROGRAMMING EXAMPLES
Check for proper transfer
q
if (calDataSize ISNOTEQUALTO IBCNTl then
gpiberr(“Data not sent properly”)
Wait for operation to complete (page 3-12)
q
WaitForInstr()
Turn on/apply error correction
q
Send “CON”
3-6EXAMPLE 4This is an example sequence showing data string input to the
37XXXD.The string sent below is used to set hardcopy data output la
bels.
The 37XXXD requires the double quote characters (“ ”) to delimit
ASCII strings being sent to it. That is, to send a string called mystring
you would actually send
programming languages also delimit a character string with double
quotes. In order to send the 37XXXD a quote(“)asaregular character, you must precede it with the backslash (\) character in the C language and with a quote character (”) in BASIC.
“
mystring”.This presents a problem since
-
NOTE
A 37XXXD ASCII string may also be delimited using
a single quote character(')atthebeginning and end
of the string.In which case,the backslash (\) for C
and the double quote (“) in BASIC are not required.
n
Define DUT Model in the data label.
The following command sequence needs to be sent to the
37XXXD:
LMS “4_8_FILTER”
q
If using C use this syntax
Send (0,6,“LMS \”4_8_FILTER\”“,NLend)
q
If using BASIC use this syntax
Send (0,6,“LMS ““4_8_FILTER”””,NLend)
q
Here the same command sequence can be sent with the single
quotes (' ') without the need for additional character as above.
Send (0,6,“LMS '4_8_FILTER'”,NLend)
n
If shutting down the GPIB immediately after this series of com
mands, then you must also make the controller wait for the
37XXXD to completely receive this data before shut down.
WaitForInstr()
-
3-1037XXXD PM
PROGRAMMING EXAMPLESEXAMPLE 5
3-7EXAMPLE 5This example sequence lists and explains 37XXXD commands for
37XXXD internal disk operations.
Sweep, and store channel 1 trace data to memory
n
Send (0,6,“CH1;S11;CH3;S21;WFS;CH1;STD”,NLend)
Store trace memory data to hard disk
n
The following command sequence needs to be sent to the
37XXXD:
Send (0,6,“SAVE 'C:\CH1_S21.NRM'”,NLend)
Wait for operations to complete (page 3-12)
n
WaitForInstr()
Output channels 1 Tabular Data to instrument floppy disk
n
Send (0,6,“SAVE 'A:\CH1_S21.DAT'”,NLend)
Wait for operations to complete
n
WaitForInstr()
Save Front Panel and Calibration setup to hard disk
n
Send (0,6,“SAVE 'C:\SETUP1.CAL'”,NLend)
Wait for operations to complete
n
WaitForInstr()
n
Reset system to default state
Send (0,6,“*RST”,NLend)
n
Recal Front Panel and Calibration setup from hard disk
Send (0,6,“RECALL 'C:\SETUP1.CAL'”,NLend)
n
Wait for operations to complete
WaitForInstr()
n
Recall channel trace/noramlization data from hard disk to CH3
Delete channel 1 trace/normalization data file from hard disk
Send (0,6,“DEL 'C:\CH1_S21.NRM'”,NLend)
n
Wait for operations to complete
WaitForInstr()
37XXXD PM3-11
EXAMPLE PROCEDURE 1PROGRAMMING EXAMPLES
3-8EXAMPLE PROCEDURE 1This example sequence provides coding for the Wait for Instr () proce
dure used earlier in this chapter's example sequences.
NOTE
Do not use this procedure if the instrument was com
manded to output data that has yet to be read by the
program since the *OPC? query will, in itself,output
data (the character “1” )when done with previous op
eration.
Set GPIB time out limit to insure enough time is allowed for in
n
strument operations to complete. See ibtmo() in the NI488
documentation for details.
ibtmo(instrument_handle, T1000s)
Send the Operation Complete query
n
Send (0,6,“*OPC?“,NLend)
Wait for instrument to output the ASCII character “1”
n
numBytes=1
Receive(buffer, numBytes, STOPend)
Restore default time out limit
n
ibtmo(instrument_handle, T10s)
-
-
-
-
3-1237XXXD PM
PROGRAMMING EXAMPLESEXAMPLE FUNCTION 1
3-9EXAMPLE FUNCTION 1This example sequence provides coding for the GetNumBytes() func
tion used earlier in this chapter's example sequences.
GetNumBytes() reads the 37XXXD output buffer and returns the
number of data bytes to be transfered in the ensuing <Arbitrary
Block> data string (see Chapter 7, “Data Transfers”). It does this by
reading out and decoding the string data header. It will copy the
header read out of the 37XXXD into headerString so the calling pro
gram can use it in cases where the same data block will be sent back
to the 37XXXD,i.e., OC1/IC1.
NOTE
Consult your programming language documentation for
string functions to copy,concatenate,and return value of
string.
Read the first byte in the instrument output buffer. Buffer is a
n
temporary array of characters of size 10.
numBytes = 1
Receive(buffer, numBytes, STOPend)
Check to be sure it is the “#” character then copy it to header-
n
String
if (buffer[0] ISNOTEQUALTO '#') then
gpiberr(“Invalid data string”)
else COPY(buffer, headerString)
-
-
n
Read second header byte from the instrument output buffer and
append it (concatenate) to headerString
This number is the next set of bytes to read. Those
bytes when taken as a number will yield the number
of actual data bytes contained in the binary string.
n
Read the number of bytes indicated by numBytes and append
them (concatenate) to headerString
Save the buffer value as a number
numBytes = VALUEOF(buffer)
NOTE
numBytes is the number of bytes, of actual data re
quested, waiting in the output buffer of the 37XXXD.
-
37XXXD PM3-13
EXAMPLE PROCEDURE 2PROGRAMMING EXAMPLES
Return number of bytes to calling program
n
Return numBytes
NOTE
At this point headerString is exactly the same as the
data transfer header output by the 37XXXD. Recall
that this is useful to the calling program in cases
where the same data read out is to be sent back to
the instrument.
3-10EXAMPLE
PROCEDURE 2
This example sequence provides coding for the TakeCalData() proce
-
dure used earlier in this chapter's example sequences.
The TakeCalData() procedure will wait for the operator to press a key
on the computer then measure the cal standard installed.
Wait for operator to press a key on computer when he is ready
n
WAITUNTIL (key is pressed)
NOTE
Consult your compiler documentation for a function
that waits for a key to be pressed.
n
Take cal data then go on to next calibration step
Send (0,6,“TCD;NCS”,NLend)
n
Wait for operation to complete (page 3-12)
WaitForInstr()
3-1437XXXD PM
Part2
GPIBFunction
Groups
This part consists of six chapters that relate the 37XXXD GPIB
commands to functional groups. Tables within each group
provide command descriptions and relationships to front panel
keys and their associated menu functions.
Chapter 4 – describes the commands and suffix mnemonics that
relate to Measurement Functions.
Chapter 5 – describes the commands that relate to Calibration
Functions.
Chapter 6 – describes the commands that relate to Markers and
Limits Functions.
Chapter 7 – describes the commands that relate to Remote-Only
Functions.
Chapter 8 – describes the commands that relate to System Func
tions.
Chapter 9 – describes the commands that relate to Special Ap
plications Functions.
-
-
Chapter 4
Measurement Functions
Table of Contents
4-1INTRODUCTION .........................4-3
4-2SUFFIX CODES ..........................4-3
4-3CHANNELS GROUP .......................4-5
4-4DISPLAY GROUP .........................4-6
Display Mode Function: ......................4-6
Trace Memory Function:......................4-6
Limits Function: ..........................4-6
Scale Functions: ..........................4-6
Graph Type Functions: ......................4-7
4-5MEASUREMENT GROUP ....................4-9
4-6ENHANCEMENT GROUP ...................4-12
Chapter 4
Measurement Functions
4-1INTRODUCTIONThis chapter describes the measurement function commands (and suf
fix mnemonics) that control the channel control, measurement control,
display control, and enhancement group functions.
NOTE
See Chapter 9, Special Applications Functions for meas
urement applications.
-
4-2SUFFIX CODESMany 37XXXD GPIB commands require a following numeric value (or
values) that quantify the 37XXXD operational parameters being con
trolled (i.e., frequency, power, etc). These numeric values are scaled to
the following units as appropriate:
DECIBELSMETERSSECONDS
DEGREESOHMSVOLTS
HERTZ
All numeric data entries can be followed by an optional suffix mnemonic (see example). The suffix mnemonics for the 37XXXD are listed
in Table 4-1. These mnemonics define a weighting factor that is applied
to the associated numeric data value. (They perform the same function
as the data entry termination keys on the 37XXXD front panel.) Fur
thermore, suffix mnemonics imply unit type, thus enhancing the read
ability of application programs.
-
-
-
-
Example: "SRT 2 GHz”
37XXXD PM4-3
SUFFIX CODESMEASUREMENT FUNCTIONS
Table 4-1. Numeric Data Suffix Mnemonics
CodeParameter TypeWeighting Factor
DB, DBL, DBMPower1.0
DEGPhase1.0
RADPhase
HZFrequency1.0
KHZFrequency10E+3
MHZFrequency10E+6
GHZFrequency10E+9
REUReal1.0
IMUImaginary1.0
STime1.0
MSTime10E-3
US, USCTime10E-6
NS, NSCTime10E-9
PS, PSCTime10E-12
FSTime10E-15
M, MTRDistance1.0
CM, CMTDistance10E-2
MM, MMTDistance10E-3
OHMImpedance1.0
V, VLTVoltage1.0
MVVoltage10E-3
K, KSTemperatureDegrees Kelvin
XM3Unitless10E-3
XX1Unitless1.0
XX3Unitless10E+3
180
°
/p
4-437XXXD PM
MEASUREMENT FUNCTIONSCHANNELS GROUP
4-3CHANNELS GROUPThe commands listed in Table 4-2 perform two separate sets of
functions:
Select the currently active channel (CH1–CH4). The active chan
q
Table 4-2. Channel Command Group
nel is that channel to which any subsequent channel-based com
mands are applied.
Select single or multi-channel display mode (commands D13,
q
D14, D24, DSP,T13, and T24). Commands T13 and T24 each pro
duce a single display frame containing overlaid traces for the two
channels specified.
4-4DISPLAY GROUPThe Display key offers menu selections that provide Display Mode,
Trace Memory,Limits,Scale, and Graph Type functions, all of which
are described below.
Display Mode
Function:
Trace Memory
Function:
Limits Function:This function is closely related to the Marker key functions; therefore,
Scale Functions:This function provides for resolving measurement values. There are se
This function provides selections for the display mode: Single, Dual
1&3, Dual 2&4, Overlay 1&3, Overlay 2&4, or Four Channel.
This function provides a sequence of menus that provide memory and
math functions.Memory functions allow viewing of Data, Memory,
Data & Memory,Data times Memory, Store Memory, and Disk Opera
tions. Math functions provide Add, Substract, Multiply,and Divide op
erations.
it is described in Chapter 7, along with markers.
lections for Log or Linear Magnitude, Phase,Smith Chart, Group De
lay,Real or Imaginary.The operation of these commands are obvious,
except for SCL, REF, and OFF.
SCL Command
This command sets the scaling-per-division characteristics of the graph
on the active channel. The associated data value determines the resultant scaling factor.The SCL command can also be used to set the scaling on Smith chart type display as follows:
VAL U ESCALING
–3Sets a 3 dB compressed scale
0Sets the normal Smith chart scale
10Sets a 10 dB expanded scale
20Sets a 20 dB expanded scale
30Sets a 30 dB expanded scale
-
-
-
-
REF Command
This command selects the graticule line of the active channel data dis
play on which to place the "REFERENCE LINE." The Reference Line
is the graticule line to which the caret points on the 37XXXD display,
or graph. (Lines 0, 4, and 8 are the bottom, middle, and top of the graph
respectively.)
NOTE
There is no reference line defined for Smith charts, in
verted Smith charts,and linear polar or log polar displays.
OFF Command
This command sets the value of the offset associated with the "REFER
ENCE LINE" in the data graph display.
-
-
4-637XXXD PM
-
MEASUREMENT FUNCTIONSDISPLAY GROUP
Changing the scaling-per-division (SCL), the Reference Line position
(REF), or the offset value (OFF) in the bottom (secondary) graph of a
two graph display is accomplished by using the appropriate suffix
mnemonic for that graph, as shown in the table below. For example: to
set the scaling value for the phase display of a log/phase type graph,
use:
"SCL 20 DEG".
Graph Type
Functions:
Command
LogMag/PhaseLinMag/PhaseReal/Imaginary
SCL/OFFDEG/RADDEG/RADIMU
REFDEGDEGIMU
This function provides for selecting any of the various type of display
graphs: Log or Linear Magnitude, Phase, Real, Imaginary, Log or Lin
ear Polar, Smith Chart (Impedance), Smith Chart (Admittance), Group
Delay, Power Out, SWR, Log Magnitude and Phase, Linear Magnitude
and Phase, Real and Imaginary.
The usage of most of these commands is obvious, except SME, ISE,
SMC and ISC.
All the commands in the Display Group act on the currently selected active channel (see section 4-3, Channels
Group).
Both the SME and ISE commands require an associated data value to
be included with the command (Table 4-3). The allowable data values
for these commands are: 0, 10, 20, and 30. The example below selects a
20 dB expanded Smith chart on the active channel.
Graph Type
-
NOTE
Example: "SME 20 DBL"
Commands SMC and ISC also require an associated data value to be
included with the command. The allowable data values for these com
mands are 0 and 3. The example below selectsa3dBcompressed
Smith chart on the active channel.
Example: "SMC 3 DBL"
The Display key commands are listed in Table 4-3.
-
37XXXD PM4-7
DISPLAY GROUPMEASUREMENT FUNCTIONS
Table 4-3. Display Group Commands (1 of 2)
CommandDescription
ADDSelect addition as trace math for active channel
APREnter group delay aperture setting on active channel
APR?Output group delay aperture setting on active channel
ASCAutoscale the active channel display
ASPEnter polar stop sweep position angle
ASP?Output polar stop sweep position angle
ASTEnter polar start sweep position angle
AST?Output polar start sweep position angle
DATDisplay data only on active channel
DAT?Output trace memory display mode
DIASelect air as active dielectric
DIEEnter a dielectric value
DIMSelect microporous teflon as active dielectric
DIPSelect polyethylene as active dielectric
DITSelect Teflon as active dielectric
DIVSelect division as trace math for active channel
DIX?Output dielectric constant
DLASelect group delay display for active channel
DNMDisplay data normalized to trace memory on active channel
DTMDisplay measurement data and trace memory on active channel
GRF?Output graph type for active channel
IMGSelect imaginary display for active channel
ISCEnter scale and select inverted compressed Smith Chart display
ISEEnter scale and select inverted expanded Smith Chart display
ISMSelect normal inverted Smith Chart for active channel
LINSelect linear magnitude display for active channel
LPHSelect linear magnitude and phase display for active channel
MAGSelect log magnitude display for active channel
MEMDisplay trace memory on active channel
MINSelect subtraction as trace math for active channel
MOSETEnter constant offset log magnitude for active channel
MOSET?Output constant offset log magnitude for active channel
MPHSelect log magnitude and phase display for active channel
MTH?Output trace math math type
MULSelect multiplication as trace math for active channel
OFFEnter offset value for top graph of active channel
OFF2Enter offset value for bottom graph of active channel
OFF2?Output offset value for bottom graph of active channel
OFF?Output offset value for top graph of active channel
PCPSelect measurement phase polar chart mode
PCSSelect sweep position polar chart mode
PCX?Output polar chart mode
PHASelect phase display for active channel
PHOEnter phase offset for display channel
PHO?Output phase offset for display channel
PLGSelect log polar display for active channel
PLRSelect linear polar display for active channel
POSETEnter constant offset phase for active channel
POSET?Output constant offset phase for active channel
POWSelect power out display for active channel
4-837XXXD PM
MEASUREMENT FUNCTIONSMEASUREMENT GROUP
Table 4-3. Display Group Commands (2 of 2)
CommandDescription
RDASelect automatic reference delay calculation
RDDEnter reference delay in distance for active channel
RDD?Output reference delay in distance for active channel
RDTEnter reference delay in time for active channel
RDT?Output reference delay in time for active channel
REFEnter reference line for top graph of active channel
REF2Enter reference line for bottom graph of active channel
REF2?Output reference line for bottom graph of active channel
REF?Output reference line for top graph of active channel
RELSelect real display for active channel
RIMSelect real and imaginary display for active channel
SCLEnter Scale Resolution for top graph of active channel
SCL2Enter Scale Resolution for bottom graph of active channel
SCL2?Output Scale Resolution for bottom graph of active channel
SCL?Output Scale Resolution for top graph of active channel
SETUPDisplay setup menu
SMCEnter scale and select compressed Smith Chart display
SMEEnter scale and select expanded Smith Chart display
SMISelect normal Smith Chart for active channel
STDStore trace to memory on active channel
SWRSelect SWR display for active channel
4-5MEASUREMENT GROUPThe commands listed in Table 4-4 control sweep and test signal
funcions. This inicludes frequency, power, attenuation, Hold functions,
and Trigger/IF calibration.
Table 4-4. Measurement Group Commands (1 of 3)
CommandDescription
AH0Turn automatic DUT protection off
AH1Turn automatic DUT protection on
AHX?Output automatic DUT protection on/off status
BH0Turn bias off while in hold
BH1Turn bias on while in hold
BHX?Output bias on/off during hold status
CNTREnter center frequency
CNTR?Output center frequency
CTNContinue sweeping from current point
CWDECSubtract 1 from the current CW index
CWFEnter CW frequency and turn CW on
CWF?Output CW frequency
CWIEnter index for CW frequency and turn CW on
CWI2F?Output frequency for index given
CWI?Output current index number
CWINCAdd 1 to the current CW index
CWN2IAdd N to the current CW index
37XXXD PM4-9
MEASUREMENT GROUPMEASUREMENT FUNCTIONS
Table 4-4. Measurement Group Commands (2 of 3)
CommandDescription
CWONTurn CW on at current CW frequency
CWON?Output CW on/off status
CWPEnter number of points drawn in CW
CWP?Output number of points drawn in CW
CWSRTSet CW frequency to the start frequency
CWSTPSet CW frequency to the stop frequency
EANAINMeasure External Analog In on active channel
FHISet data points to 1601
FILFill defined discrete frequency range
FLOSet data points to 101
FMESet data points to 401
FP0Turn flat power correction off
FP1Turn flat power correction on
FRCClear all defined discrete frequency ranges
FRIEnter Discrete Fill increment frequency
FRPEnter Discrete Fill number of points
FRSEnter Discrete Fill start frequency
HC0Disable internal IF calibration
HC1Enable internal IF calibration and trigger an IF calibration
HCTTrigger an IF calibration
HCX?Output internal IF calibration enable/disable status
HLDPut sweep into hold mode
HLD?Output the sweep hold status
HLDX?Output hold mode (continue, restart, or single sweep)
IFPEnter current front panel setup
IFVEnter frequency values
IS1Enter front panel setup 1
IS10Enter front panel setup 10
IS2Enter front panel setup 2
IS3Enter front panel setup 3
IS4Enter front panel setup 4
IS5Enter front panel setup 5
IS6Enter front panel setup 6
IS7Enter front panel setup 7
IS8Enter front panel setup 8
IS9Enter front panel setup 9
LA1Select a1 = Ra as phase lock for parameter being defined
LA2Select a2 = Rb as phase lock for parameter being defined
LAX?Output phase lock selection for parameter being defined
NP101Set data points to 101
NP1601Set data points to 1601
NP201Set data points to 201
NP401Set data points to 401
NP51Set data points to 51
NP801Set data points to 801
ONDFOutput number of discrete frequencies
PTPEnter the target power for flat power correction
PTP?Output the target power for flat power correction
PW1Enter external source 1 power level
PW1?Output external source 1 power level
PW2Enter external source power level
PW2?Output external source power level
4-1037XXXD PM
MEASUREMENT FUNCTIONSMEASUREMENT GROUP
Table 4-4. Measurement Group Commands (3 of 3)
CommandDescription
PWREnter internal source power level
PWR?Output internal source power level
RH0Select RF off in hold mode
RH1Select RF on in hold
RHX?Output RF on/off during hold status
RT0Turn retrace rf off
RT1Turn retrace rf on
RTX?Output retrace rf on/off status
S11Measure S11 on active channel
S12Measure S12 on active channel
S21Measure S21 on active channel
S22Measure S22 on active channel
SA1Enter port 1 source attenuator value
SA1?Output port 1 source attenuator value
SA1MAX?Output port 1 source attenuator max value
SAMP2Use 2 samplers for measurements
SAMP3Use 3 samplers for measurements
SAMP?Output the number of samplers used for measurements
SELSPSelect S-Parameter test set operation
SPANEnter frequency span
SPAN?Output frequency span
SRC2?Output external source 2 existence information
SRTEnter start frequency
SRT?Output start frequency
STPEnter stop frequency
STP?Output stop frequency
SWPReturn to normal sweep mode
SWP?Output sweep mode
SWPDIR?Output instantaneous sweep direction forward/reverse
SXX?Output s parameter or user defined parameter of active channel
TA2Enter port 2 test attenuator value
TA2?Output port 2 test attenuator value
TA2MAX?Output port 2 test attenuator max value
TEXSelect external measurement triggering
TINSelect internal measurement triggering
TRSTrigger/restart sweep
TXX?Output trigger source
WFSWait full sweep until all display data is valid
37XXXD PM4-11
ENHANCEMENT GROUPMEASUREMENT FUNCTIONS
4-6ENHANCEMENT GROUPThe commands listed in Table 4-5 control the data enhancement func
tions of the 37XXXD, which include IF bandwidth, averaging,and
smoothing. These functions are the same as those controlled by the
37XXXD front panel Enhancement key group.
NOTE
Most of the commands associated with the Options Menu
key are contained in Chapter 9, Special Applications Func
tions. However, the Triggers and I.F. Cal commands are
contained in Table 4-4 in section 4-5, Measurement Con
trol.
Table 4-5. Enhancement Group Commands
CommandDescription
AOFTurn averaging off
AOF?Output averaging on/off status
AONTurn averaging on
AVGEnter averaging count and turn on
AVG?Output averaging count
AVGCNT?Output the current sweep-by-sweep average sweep count
IF1Select 10 Hz IF bandwidth
IF2Select 100 Hz IF bandwidth
IF3Select 1 KHz IF bandwidth
IF4Select 10 KHz IF bandwidth
IFASelect 30 KHz IF bandwidth
IFMSelect 10 Hz IF bandwidth
IFNSelect 1 KHz IF bandwidth
IFRSelect 100 Hz IF bandwidth
IFX?Output IF bandwidth
MEASDLYSet Measurement Delay time
MEASDLY0Disable Measurement Delay
MEASDLY1Enable Measurement Delay
MEASDLY?Output Measurement Delay time
MEASDLYX?Output Measurement Delay on/off status
PTAVGSet averaging type to point-by-point averaging
RSTAVGReset the sweep-by-sweep averaging sweep count
SOFTurn off smoothing
SOF?Output smoothing on/off status
SONEnter smoothing value and turn on
SON?Output smoothing value
SPLNSelect normal source lock polarity
SPLRSelect reverse source lock polarity
SPLX?Output source lock polarity normal/reverse status
SPR0Turn spur reduction off
SPR1Turn spur reduction on
SPRX?Output spur reduction on/off status
SWAVGSet averaging type to sweep-by-sweep averaging
SWAVG?Output averaging type (sweep-by-sweep or point-by-point)
-
-
-
4-1237XXXD PM
Chapter 5
Calibration Functions
Table of Contents
5-1INTRODUCTION .........................5-3
5-2RELATED COMMANDS .....................5-3
5-3REQUIRED COMMAND SEQUENCE .............5-4
5-4FUNCTIONAL COMMANDS..................5-6
5-5EXAMPLE PROGRAM ......................5-8
5-6FLAT TEST PORT.........................5-9
Flat Test Port Power Calibration Coefficients ..........5-9
5-7CALIBRATION COMMANDS ..................5-11
5-8AUTOCAL FUNCTIONS.....................5-15
Chapter 5
Calibration Functions
5-1INTRODUCTIONThis chapter describes the 37XXXD S-Paremter error correction (cali
bration) functions.It describes the commands used to perform the fol
lowing:
Specify the calibration method, type, standards, and parameters.
q
Control the calibration data-taking process.
q
NOTES
See Measurement/Test Signals Group for a description
·
of the flat test port power calibration commands.
· The 37XXXD calibration functions require operator intervention. However,it is possible to use the external
controller to guide the operator through the calibration
process using a suitable program containing the calibration commands described in this chapter.
5-2RELATED COMMANDSRelated, non-calibration commands used during the calibration pro-
cess are described in Table 5-1. The use of these commands, in relation
to calibration activities,is described throughout this chapter,where
appropriate. These command sets are fully described in their respective chapters as indicated in Table 5-1.
NOTE
See ICx and OCx series commands in the Data Transfer
group (Chapter 7) for information on inputting and output
ting calibration terms coefficients (error terms).
-
-
-
37XXXD PM5-3
REQUIRED COMMAND SEQUENCECALIBRATION FUNCTIONS
Table5-1. Related Commands
CommandCommand Function Group
5-3REQUIRED COMMAND
SEQUENCE
FHI, FLO, FME
NP51–NP1601
SRT, STP,
CWF, DFQ,
DFD, FRS,
FRI, FRP, FIL,
FRC
IFV, ICx, OCxData Tranfer Group (Ch 8)
*OPC, *OPC?IEEE 488.2 Group, Synchronization
AllMeasurement, Test Signals (Ch 5)
AllDisplay, Graph Type (Ch 5)
AllDisplay, Scaling (Ch 5)
AVG, A O F.
AON
IFA, IFN, IFR,
IFM, IF1–IF4
CH1–CH4Channels Group (Ch 5)
Measurement Group, Data Points
(Ch 5)
Measurement Group, Frequency
(Ch 5)
(Ch 8)
Enhancement, Averaging (Ch 5)
Enhancement, Video IF Bandwidth
(Ch 5)
A program used to control the calibration process must follow a specific order for the GPIB calibration commands that are used. Table 5-2
lists this acceptable order.
* Refer to Chapter 5, "Measurement Group" for details on these commands.
** See Chapter 8, Measurement Points Data Transfer Commands) CWF
37XXXD PM5-5
FUNCTIONAL COMMANDSCALIBRATION FUNCTIONS
5-4FUNCTIONAL
COMMANDS
Commands used for special types of calibrations are described in Table
5-3. The commands are used to invoke options and non-standard cali
bration procedures,and to simulate a calibration process.
Table 5-3. Functional Commands Listing (1 of 2)
CommandFunctionDescription
NOCSpecify Normal Sweep
Calibration
DFCSpecify Discrete Fre
quency Calibration
CWCSpecify CW CalibrationThis command sets up a continuous wave (CW) calibration. Use CWF to
P1C, P2CSet up to Specify Port 1
(PIC) or Port 2 (P2C) Standards
CNDOther Connector Specifica-
tion
SLD, BBLSpecify Sliding Load or
Broad Band Load for Cali
bration
LM2, LM3These commands are used to select a match for the second or the third
A12, A8T,
A8R, ARF,
AFT, ARB,
ARR, ABT,
ART
Calibration simulationThese commands simulate the completion of a calibration. The Axx series
-
This command sets up a normal frequency range calibration.
This command sets up a calibration at discrete frequencies only. Use dis
crete fill commands to input frequency list for calibration. Refer to Chapter
5, Measurement Functions, section 5-4.
Alternatively, the IFV command allows for a frequency list input of calibra
tion frequencies. Refer to “Data Transfer Commands Group (Chapter 8),”
for more details.
input CW frequency.
This command specifies Port 1 or Port 2 as the port to which subsequent
connector-related commands will apply.
Example:
“P1C;CFK;P2C;CMK”
This sequence of commands sets up a female K connector for port 1 (P1C
CFK) and a male K connector for port 2 (P2C CMK).
This command allows a non-standard connector to be specified. This is
the same as selecting OTHER from the front panel menu. When specifying the CND command, the connector offset for the open and/or short device and the capacitance coefficients for the open device also need to be
entered to characterize the connector.
Thie SLD command specifies a sliding load. The data-taking process for
-
the load includes six slide positions. If any frequencies are below 2 GHz,
you must also use a broadband load.
device respectively during a LRM type calibration.
commands must be followed with the corresponding calibration error term
coefficients using the ICx commands (see Chapter 8).
The Axx series commands match up with corresponding calibration type
commands. For example, A12 simulates C12, A8T simulates C8T, etc.
-
-
-
NOTE
If you attempt to apply a calibration without first having entered
calibration coefficient data, the error correction may not be ap
plied (as indicated by the Apply Cal LED being momentarily
turned on, then off).
-
5-637XXXD PM
CALIBRATION FUNCTIONSFUNCTIONAL COMMANDS
Table 5-3. Functional Commands Listing (2 of 2)
CommandFunctionDescription
CON, COFTurn on/off vector error
correction
BEG, TC1,
TC2, TCD,
NCS, KEC,
RPC
U10, U15,
U25
MAT, MIXLoad match for Reflection
Calibration Sequencing
and Control commands
Calibration Kit selection
commands
devices measurement
sequences
These commands are not used during calibration. They are used during
normal measurements to apply the current calibration error correction to
the measured data (CON) or to turn off error correction calibration (COF).
These commands are used to start and control the data-taking process.
KEC will keep existing calibration error corrections and return to the
measurement mode. Command TC1 takes calibration data for the current
(calibration) standard for port 1 using a separate forward measurement
sweep. Command TC2 performs the same function for port 2 using a
separate (reverse) sweep. (Note that command TCD performs these iden
tical operations, using consecutive forward and reverse measurement
sweeps.)
Using the TC1 and TC2 commands allows one calibration standard of
eachtypetobeusedforbothports.
These commands are used to select 10, 15, or 25 mil UTF calibration kits
respectively. These calibration kits are used to perform a 37XXXD calibration for microstrip device measurements.
The MAT (MATched) command changes the measurement sequence for
the standard 12 term, coaxial, two-channel calibration so that the “open”
measurements are performed in sequence, followed by the “short” measurements. The MIX (MIXed) command returns to the normal sequence for
a two-channel 12 term calibration.
-
37XXXD PM5-7
EXAMPLE PROGRAMCALIBRATION FUNCTIONS
5-5EXAMPLE PROGRAMThe following is an example of how to set up a calibration sequence for
This example code sets up a calibration using standard calibration
mode (SCM), coax cable media (LTC), and 12-term calibration type
(C12). A discrete set of points is defined for frequency operation start
ing at 1 GHz (FRS 1.0 GHZ), spaced 100 MHz apart (FRI 100 MHZ),
at 41 consecutive points (FRP 41 XX1). This range is confirmed or
"filled" ( FIL), then completed (DFD).
The Port 1 test port connector is defined as a female type K connector
(P1C CFK) and the Port 2 test port connector is defined as a male K
type connector (P2C CMK). Broadband loads are selected as the de
fault load type (BBL). The BEG command instructs the 37XXXD to
begin the calibration-data-taking-process.
-
-
The calibration control program should contain commands to control
the data-collection portion of the calibration process. Typical commands used for this process are:
q
Take Calibration Data for Current Standard (TCD,orTC1,or
TC2)
q
Go on to the Next Calibration Step (NCS)
q
Averaging On and Set to Value (AVG)
q
Set IF Bandwidth to 10 Hz (IF1)
q
Set IF Bandwidth to 100 Hz (IF2)
q
Set IF Bandwidth to 1 KHz (IF3)
q
Set IF Bandwidth to 10 KHz (IF4)
q
Any Graph Type Specification or Scaling Change
q
Active Channel Specification (CH1–CH4)
The TCD (or TC1,orTC2) and NCS commands control the data-tak
ing process.Commands AVG, IFN, IFR, IFA, and IFM control the
data-enhancement function used for a particular measurement (refer
to Chapter 3, section 5-6, Enhancement Commands).
Before the TCD (or TC1,orTC2) and NCS commands are invoked in
the program, the system operator must be instructed to perform the
exact steps necessary to setup the calibration sequence for the type of
37XXXD calibration to be used. An example program segment to con
tinue the 12-term calibration started in the previous example is shown
on the next page. This example program segment is written in HP-BA
SIC.
-
The calibration control program should determine if the 37XXXD is
ready for the next step of the calibration sequence before prompting
the system operator to connect new calibration standards to the test
5-837XXXD PM
CALIBRATION FUNCTIONSFLAT TEST PORT
ports. This can be done by monitoring the status byte of the 37XXXD
or by waiting for the operation to complete after executing the NCS
command.
For example, the commands in the following example instruct the
37XXXD to take calibration data (TCD), go to the next calibration step
(NCS), then output the number "1" (*OPC?). When the controller is
able to read the number "1" from the 37XXXD, the calibration step is
complete.
260 OUTPUT 706;"TCD;NCS;*OPC?"
270 ENTER 706; N$ ! READ AND DISCARD ASCII '1' WHEN
STEP IS COMPLETE
280 DISP "CALIBRATION STEP COMPLETE"
5-6FLAT TEST PORTSignal source power correction data produced during this type of
37XXXD calibration is used to flatten the signal power output from
the test set port(s) over a specified frequency range. This feature is
used to provide flat test stimulus signals to the device-under-test
while performing normal measurements.
Flat Test Port Power
Calibration Coefficients
This process requires operator intervention. The system operator is
guided through a sequence of operations and measurements that
make up the flat test port calibration sequence. Before attempting to
write a GPIB controlled program to produce this calibration sequence,
first become thoroughly familiar with the manual procedure.
Flat test port calibrations require considerable time to perform. The
time required is dependent upon the number of points selected; For
these calibrations,the GPIB timeout value must be increased accord
ingly, or the control program must generate an appropriate time delay
before executing subsequent commands. See the documentation for
your GPIB controller for timeout-setting procedures.
The commands listed in Table 5-4 are used to invoke and control flat
test port calibrations.
The coefficients are input and output using the following codes:
q
IFPC – Enter the power sweep linearity calibration coefficients
q
OFPC – Output the power sweep linearity calibration coeffi
cients
These codes would be useful in applications where there is no power
meter to hook up to the 37000 to perform the calibration normally, or
the power meter is not one of the ones that the 37000 has been pro
grammed to interface with.
-
-
-
The code OFPC outputs an arbitrary block of binary or ASCII data de
pending on the output mode selected with the codes FMA, FMB, FMC,
37XXXD PM5-9
-
FLAT TEST PORTCALIBRATION FUNCTIONS
LSB and MSB.See the description of these codes in Chapter 10. See
Chapter 10, section 10-3 for a description of the arbitrary block format.
Each coefficient represents the adjustment in dB (correct to a hun
dredth of a dB) required to achieve the correct power at the particular
frequency point. There will be as many coefficients as there are fre
quency points in the sweep. If a VNA does not currently have a valid
power sweep linearity calibration in place when the OFPC is received,
an arbitrary block will be sent with zeros for each coefficient.
The code IFPC is used to input coefficients into the VNA and set up a
valid flat test port power calibration. The coefficients are contained in
an arbitrary block, which follows IFPC.The makeup of the arbitrary
block is identical to the one described above. The VNA must be pro
grammed with the appropriate number of frequency points prior to re
ceiving IFPC. If the number of coefficients in the arbitrary block does
not match what would be required by the current VNA setup, the data
will be rejected and an error message displayed on the screen and re
corded in the service log.
Table 5-4. Flat Test Port Power Commands
-
-
-
-
-
CommandsDescription
PTPEnter target power for calibration.
PTP?Output target power for calibration.
PTSSelects the number of frequency points (1 – 65) to be skipped between each measured point on
the power measurement sweep. It therefore determines the number of points measured on each
sweep .
PTS?Skipped points for flat test port power calibration query.
SFCStarts the flat test port calibration sequence.
FP1Causes the flat test port power correction data to be used during normal measurement mode.
FP0Turns off the flat test port power correction for normal measurement mode.
FPX?Flat power ON / OFFstatus query.
IFPCEnter the power sweep linearity calibration coefficients
OFPCOutput the power sweep linearity calibration coefficients
5-1037XXXD PM
CALIBRATION FUNCTIONSCALIBRATION COMMANDS
5-7CALIBRATION
COMMANDS
Table 5-5 provides a listing of the commands used to perform measure
ment calibrations.Unless otherwise noted, all front panel menus men
tioned in Table 5-5 are accessed by first pressing the Begin Cal key.
Table 5-5. Calibration Commands (1 of 4)
CommandDescription
A12Simulate 12-term calibration
A8RSimulate 1-path 2-port calibration reverse path
A8TSimulate 1-path 2-port calibration forward path
ABTSimulate trans freq response calibration forward and reverse
AFTSimulate transmission frequency response calibration forward path
ARBSimulate reflection only calibration both ports
ARFSimulate reflection only calibration port 1
ARRSimulate reflection only calibration port 2
ARTSimulate trans freq response calibration reverse path
BBLSelect broadband load for calibration
BBZEnter broadband load impedance for calibration
BBZLEnter broadband load inductance for calibration
BEGBegin taking calibration data
BPFEnter break point frequency for 3 line LRL calibration
C12Select 12 term calibration
C8RSelect 1-path 2-port calibration reverse path
C8TSelect 1-path 2-port calibration forward path
CBTSelect trans freq response calibration forward and reverse
CC0Enter capacitance coefficient 0 for open
CC1Enter capacitance coefficient 1 for open
CC2Enter capacitance coefficient 2 for open
CC3Enter capacitance coefficient 3 for open
CF1Select female 1.0 mm connector for current port
CF2Select female 2.4mm connector for current port
CF3Select female GPC-3.5 connector for current port
CF716Select female 7/16 connector for current port
CFCSelect female TNC connector for current port
CFKSelect female K connector for current port
CFNSelect female Type N connector for current port
CFN75Select Female type N 75-ohm connector for current port
CFSSelect female SMA connector for current port
CFSPSelect Special Female connector for current port
CFSPASelect Band A special female connector for current port
CFSPBSelect Band B special female connector for current port
CFSPCSelect Band C special female connector for current port
CFTSelect trans freq response calibration forward path
CFVSelect female V connector for current port
CL0Enter inductive coefficient 0 for short
CL1Enter inductive coefficient 1 for short
CL2Enter inductive coefficient 2 for short
CL3Enter inductive coefficient 3 for short
CM1Select male 1.0 mm connector for current port
CM2Select male 2.4mm connector for current port
CM3Select male GPC-3.5 connector for current port
CM716Select male 7/16 connector for current port
-
-
37XXXD PM5-11
CALIBRATION COMMANDSCALIBRATION FUNCTIONS
Table 5-5. Calibration Commands (2 of 4)
CommandDescription
CMCSelect male TNC connector for current port
CMKSelect male K connector for current port
CMNSelect male N connector for current port
CMN75Select Male type N 75-Ohm connector for current port
CMSSelect male SMA connector for current port
CMSPSelect Special Male connector for current port
CMSPASelect Band A special male connector for current port
CMSPBSelect Band B special male connector for current port
CMSPCSelect Band C special male connector for current port
CMVSelect male V connector for current port
CMX?Output calibration method
CNDSelect user specified connector for current port
CNGSelect GPC-7 connector for current port
COFTurn error correction off
CONTurn error correction on
CON?Output error correction on/off status
COOEnter offset for open for user specified connector (Standard Calibration)
COSEnter offset for short for user specified connector
CRBSelect reflection only calibration both ports
CRFSelect reflection only calibration port 1
CRRSelect reflection only calibration port 2
CRTSelect trans freq response calibration reverse path
CSF?Output cal start frequency
CTF?Output cal stop frequency
CWCSelect CW frequency calibration data points
CXX?Output calibration type
DFCSelect discrete frequency calibration data points
DFDDone specifying discrete frequency ranges
DFQEnter single discrete frequency
IC2Input Calibration Coefficient 2
IC3Enter calibration coefficient 3
IC4Enter calibration coefficient 4
IC5Enter calibration coefficient 5
IC6Enter calibration coefficient 6
IC7Enter calibration coefficient 7
IC8Enter calibration coefficient 8
IC9Enter calibration coefficient 9
ICAEnter calibration coefficient 10
ICBEnter calibration coefficient 11
ICCEnter calibration coefficient 12
ICDEnter corrected data for active channel parameter
ICFEnter front panel setup and calibration data
ICLEnter all applicable calibration coefficients for cal type
IFDEnter final data for active channel parameter
ISFExclude isolation
ISNInclude isolation
KECKeep existing calibration data
LCMSelect LRL calibration method
LL1Enter length of line 1 for LRL calibration
LL2Enter length of line 2 for LRL calibration
LL3Enter length of line 3 for LRL calibration
5-1237XXXD PM
CALIBRATION FUNCTIONSCALIBRATION COMMANDS
Table 5-5. Calibration Commands (3 of 4)
CommandDescription
LLZEnter line impedance for LRL calibration
LM2Select a match for the second device during a LRM type calibration
LM3Select a match for the third device during a LRM type calibration
LMZEnter match impedance for LRM calibration
LMZ?Output match impedance for LRM calibration
LMZLEnter match inductance for LRM calibration
LMZL?Output match inductance for LRM calibration
LR2Specify 2 line LRL calibration
LR3Specify 3 line LRL calibration
LTCSelect coaxial transmission line for calibration
LTUSelect microstrip transmission line for calibration
LTWSelect waveguide transmission line for calibration
LTX?Output line type
MATSelect matched reflective devices during cal
MIXSelect mixed reflective devices during calibration
NCSGo to next calibration step
NOCSelect normal calibration data points
O3CMSelect Triple Offset Short calibration method
OCMSelect offset short calibration method
ONCTOutput number of cal terms for current calibration
P1CSelect port 1 for connector specification
P1C?Output port 1 connector type
P1P?Output approximate power level at port 1
P2CSelect port 2 for connector specification
P2C?Output port 2 connector type
PSPEnter number of power sweeps for flat power correction (obsolete)
PSP?Output number of power sweeps for flat power correction (obsolete)
PTSEnter number of points to be skipped during flat power correction
PTS?Output number of points to be skipped during flat power correction
RGZSelect reflective device greater than Z0
RLZSelect reflective device less than Z0
RM1Select reference plane at line 1 midpoint
ROLEnter reflective device offset length
RPCRepeat previous calibration
RRPSelect reference plane at reflection plane
SBDEnter substrate dielectric for microstrip calibration
SBTEnter substrate thickness for microstrip calibration
SCMSelect standard calibration method
SFCPerform flat test port calibration
SH1Set offset short 1 or 2 offset length for offset short calibration
SH2Set offset short 1 or 2 offset length for offset short calibration
SLDSelect sliding load for calibration
TC1Take calibration data for port 1
TC2Take calibration data for port 2
TCDTake calibration data on one or both ports as necessary
TCMSelect the TRM calibration method
TDCSelect time domain harmonic frequency calibration data points
TLZEnter through line impedance for calibration
TOLEnter through offset length for calibration
U10Select 10 mil UTF calibration kit
37XXXD PM5-13
CALIBRATION COMMANDSCALIBRATION FUNCTIONS
Table 5-5. Calibration Commands (4 of 4)
CommandDescription
U15Select 15 mil UTF calibration kit
U25Select 25 mil UTF calibration kit
USEEnter effective dielectric for microstrip calibration
USWEnter microstrip width for microstrip calibration
USZEnter microstrip impedance for microstrip calibration
WCOEnter waveguide cutoff frequency for user defined kit
WKDSelect user defined waveguide calibration kit
WKISelect installed waveguide calibration kit
WSH1Enter waveguide short offset 1 for user defined kit
WSH2Enter waveguide short offset 2 for user defined kit
WSH3Enter waveguide short 3 offset for user defined kit
5-1437XXXD PM
CALIBRATION FUNCTIONSAUTOCAL FUNCTIONS
5-8AUTOCAL FUNCTIONSThis function requires an optional AutoCal â module that provides an
automated method for performing fast, repeatable high-quality cali
brations. The AutoCal module is inserted between the VNA test ports
to perform the calibration. The commands for implementing this func
tion remotely are provided in Table 5-6.
Table 5-6. List of AutoCal Commands (1 of 2)
CommandDescription
ABORTCALAbort calibration in progress and keep existing calibration data
ACAASet AutoCal standard to assurance
ACADPLEnter AutoCal adapter length
ACADPL?Output AutoCal adapter length
ACADRSet AutoCal type to adapter removal
ACAL1R2Set adapter removal port configuration to ADAPT & L=1 and R=2
ACAR1L2Set adapter removal port configuration to ADAPT & R=1 and L=2
ACARP?Output AutoCal adapter removal port configuration
ACDEFSelect default AutoCal isolation averaging factor
ACF2P?Output AutoCal full 2 port configuration
ACF2TCSet AutoCal 2 port thru type to calibrator
ACF2TTSet AutoCal 2 port thru type to true thru
ACF2TX?Output AutoCal 2 port thru type selection
ACHFDSave AutoCal characterization data to floppy disk
ACHHDSave AutoCal characterization data to hard disk
ACIAFEnter user AutoCal isolation averaging factor
ACIAF?Output user AutoCal isolation averaging factor
ACIAX?Output AutoCal isolation averaging factor omit/default/user selection
ACISOEnter AutoCal isolation averaging number
ACISO?Output AutoCal isolation averaging number
ACL1AR2Set adapter removal port configuration to L=1 and ADAPT & R=2
ACL1R2Set AutoCal full 2 port configuration to L=1 and R=2
ACLOEnter AutoCal load averaging number
ACLO?Output AutoCal load averaging number
ACLOADSet AutoCal standard to load
ACOMITOmit using AutoCal isolation averaging factor
ACOPENSet AutoCal standard to open
ACP1?Output AutoCal S11 port configuration
ACP1LSet AutoCal S11 port configuration to left
ACP1RSet AutoCal S11 port configuration to right
ACP2?Output AutoCal S22 port configuration
ACP2LSet AutoCal S22 port configuration to left
ACP2RSet AutoCal S22 port configuration to right
ACPLSet AutoCal S11 port configuration to left
ACPRSet AutoCal S11 port configuration to right
ACR1AL2Set adapter removal port configuration to R=1 and ADAPT & L=2
ACR1L2Set AutoCal full 2 port configuration to R=1 and L=2
ACRFLEnter AutoCal reflection averaging number
ACRFL?Output AutoCal reflection averaging number
ACS11Set AutoCal type to S11
ACS22Set AutoCal type to S22
ACSF2PSet AutoCal type to full 2 port
-
-
37XXXD PM5-15
AUTOCAL FUNCTIONSCALIBRATION FUNCTIONS
Table 5-6. List of AutoCal Commands (2 of 2)
CommandDescription
ACSHORTSet AutoCal standard to short
ACSTD?Output AutoCal standard
ACSWEnter AutoCal switch averaging number
ACSW?Output AutoCal switch averaging number
ACTHRUSet AutoCal standard to thru
ACTUEnter AutoCal thru averaging number
ACTU?Output AutoCal thru averaging number
ACTUAVGEnter AutoCal thru update averaging number
ACTUAVG?Output AutoCal thru update averaging number
ACTULSApply last thru update cal setup
ACX?Output AutoCal type
BEGACStart AutoCal
BEGCHStart AutoCal characterization
BEGTUStart AutoCal thru update
IACCHARInput AutoCal characterization data from the GPIB
OACCHAROutput AutoCal characterization data to the GPIB
TACDTake AutoCal data
5-1637XXXD PM
Chapter 6
Markers and Limits
Functions
Table of Contents
6-1INTRODUCTION .........................6-3
6-2MARKERS .............................6-3
6-3LIMITS...............................6-7
Single (Non-Segmented) Limits..................6-7
Segmented Limits .........................6-8
Limits Example ..........................6-8
Limits Pass/FailTesting ......................6-8
Chapter 6
Markers and Limits
Functions
6-1INTRODUCTIONThis chapter describes markers and limits commands.
6-2MARKERSThe commands listed in Table 6-1 (next page) control the location and
display of the markers and the functions related to the markers.A full
description of each command mnemonic is contained in Chapter 11,
Command Dictionary.
A marker is turned on whenever any of the following conditions occur:
q When the marker is set to a value
Example: "MK2 20 GHZ"
q When the marker is selected for readout
Example: "MR2"
q When the marker is selected as the delta reference marker (left)
Example: "DR2 4.5632 GHZ"
MMN and MMX Commands — The MMN and MMX commands move
the active marker to the minimum and maximum trace values on the
active channel, respectively. There must be an active marker selected
for these command to execute.
Example: "WFS;MR1;MMX"
This code instructs the 37XXX to:
q
Wait for a full sweep of data to be present (WFS)
q
Turn on marker 1 and select it for readout (MR1)
q
Move marker 1 to the maximum value of the trace on the active
channel (MMX)
37XXXD PM6-3
MARKERSMARKERS/LIMITS FUNCTIONS
Table 6-1. Marker Commands (1 of 3)
CommandDescription
AMKRSelect active marker on all channels marker mode
BWL3Set bandwidth loss value to 3 dB
BWLSEnter bandwidth loss value
BWLS?Output bandwidth loss value
DR1Select Marker 1 as Delta Reference Marker
DR2Select Marker 2 as Delta Reference Marker
DR3Select Marker 3 as Delta Reference Marker
DR4Select Marker 4 as Delta Reference Marker
DR5Select Marker 5 as Delta Reference Marker
DR6Select Marker 6 as Delta Reference Marker
DRFTurn delta reference mode on
DROTurn delta reference mode off
DRO?Output delta reference mode on/off status
DRX?Output delta reference marker number
DSF0Disable filter shape factor calculation
DSF1Enable filter shape factor calculation
DSFX?Output filter shape factor calculation enable/disable status
DSQ0Disable filter Q calculation
DSQ1Enable filter Q calculation
DSQX?Output filter Q calculation enable/disable status
FLTBW?Output filter bandwidth
FLTC?Output filter center frequency
FLTL?Output filter loss at reference value
FLTQ?Output filter Q
FLTS?Output filter shape factor
FMKRSelect filter parameters marker mode
M1CSet CW mode at marker 1 frequency
M1ESet sweep/zoom end to marker 1 frequency distance or time
M1SSet sweep/zoom start to marker 1 frequency distance or time
M2CSet CW mode at marker 2 frequency
M2ESet sweep/zoom end to marker 2 frequency distance or time
M2SSet sweep/zoom start to marker 2 frequency distance or time
M3CSet CW mode at marker 3 frequency
M3ESet sweep/zoom end to marker 3 frequency distance or time
M3SSet sweep/zoom start to marker 3 frequency distance or time
M4CSet CW mode at marker 4 frequency
M4ESet sweep/zoom end to marker 4 frequency distance or time
M4SSet sweep/zoom start to marker 4 frequency distance or time
M5CSet CW mode at marker 5 frequency
M5ESet sweep/zoom end to marker 5 frequency distance or time
M5SSet sweep/zoom start to marker 5 frequency distance or time
M6CSet CW mode at marker 6 frequency
M6ESet sweep/zoom end to marker 6 frequency distance or time
M6SSet sweep/zoom start to marker 6 frequency distance or time
MK1Enter marker 1 frequency distance or time and turn on
MK1?Output marker 1 frequency distance or time
MK2Enter marker 2 frequency distance or time and turn on
MK2?Output marker 2 frequency distance or time
MK3Enter marker 3 frequency distance or time and turn on
6-437XXXD PM
MARKERS AND LIMITSMARKERS
FUNCTIONSCOMMANDS
Table 6-1. Marker Commands (2 of 3)
CommandDescription
MK3?Output marker 3 frequency distance or time
MK4Enter marker 4 frequency distance or time and turn on
MK4?Output marker 4 frequency distance or time
MK5Enter marker 5 frequency distance or time and turn on
MK5?Output marker 5 frequency distance or time
MK6Enter marker 6 frequency distance or time and turn on
MK6?Output marker 6 frequency distance or time
MKRCSelect interpolated marker functionality
MKRDSelect discrete marker functionality
MKRX?Output interpolated/discrete marker functionality
MKSLMarker search left
MKSRMarker search right
MKT0Turn marker tracking off
MKT1Turn marker tracking on
MKTX?Output marker tracking on/off status
MMNMove active marker to minimum trace value
MMXMove active marker to maximum trace value
MO1Turn off marker 1
MO2Turn off marker 2
MO3Turn off marker 3
MO4Turn off marker 4
MO5Turn off marker 5
MO6Turn off marker 6
MOFTurn marker display off
MONTurn marker display on
MON?Output marker display on/off status
MR1Turn marker 1 on and make it the active marker
MR1?Output marker 1 on/off status
MR2Turn marker 2 on and make it the active marker
MR2?Output marker 2 on/off status
MR3Turn marker 3 on and make it the active marker
MR3?Output marker 3 on/off status
MR4Turn marker 4 on and make it the active marker
MR4?Output marker 4 on/off status
MR5Turn marker 5 on and make it the active marker
MR5?Output marker 5 on/off status
MR6Turn marker 6 on and make it the active marker
MR6?Output marker 6 on/off status
MRMDisplay the Marker Readout menu
MRX?Output active marker number
MSFHEnter high loss value for shape factor calculation
MSFH?Output high loss value for shape factor calculation
MSFLEnter low loss value for shape factor calculation
MSFL?Output low loss value for shape factor calculation
MSR0Select 0 as reference for marker search and bandwidth calculation
MSRDSelect delta reference marker as reference for marker search and bandwidth calculation
MSRMSelect maximum as reference for marker search and bandwidth calculation
MSRX?Output reference selection for marker search and bandwidth calculation
NMKRSelect normal markers on active channel marker mode
SMKRSelect marker search marker mode
37XXX PM6-5
MARKERSMARKERS AND LIMITS
COMMANDSFUNCTIONS
Table 6-1. Marker Commands (3 of 3)
CommandDescription
SRCHEnter marker search value
SRCH?Output marker search value
XMKR?Output marker mode
6-637XXX PM
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.