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 37XXXC GPIB Programmer Interface
This chapter provides an introduction to the 37XXXC 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 37XXXC Programming Examples
This chapter provides sample program elements that demonstrate common 37XXXC operations.
These sample elements are useful as an aid in developing 37XXXC programs.
Part 2 — GPIB Function Groups
Chapter 4 — Measurement Functions
This chapter provides a detailed description of the 37XXXC specific GPIB commands that control the
various data display and measurement control functions of the 37XXXC.
Chapter 5 — Calibration Functions
This chapter describes the 37XXXC 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 37XXXC 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.
-
37XXXC PMi
Part 3 — Programming Reference
Chapter 10 — Command Dictionary
This chapter provides an alphabetically-ordered, dictionary-type listing and description of all
37XXXC 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 37XXXC. Much of
this information is presented in Chapters 4 through 10, but is provided in this chapter for easy ac
cess.
Chapter 12 — Error Messages
This chapter provides a list of all Error Messages including those related to remote-only (GPIB) op
eration of the 37XXXC.
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 37XXXC 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.
-
-
-
ii37XXXC PM
Part1
TheGPIB
Interface
This part consists of three chapters that describe how the
IEEE- 488 (GPIB) interface is implemented within the 37XXXC
Vector Network Analyzer and how to perform basic GPIB communications operations.
Chapter 1 – briefly describes the 37XXXC GPIB programmer in-
terface and describes the communication to and from the interface during remote-only (GPIB) operation of the 37XXXC.
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 37XXXC programming techniques.They are also
useful as an aid in developing 37XXXC programs.
-
Chapter 1
Series 37XXXC 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
37XXXC Specific Messages .................1-8
Separator
Characters ..........................1-9
Terminator
Character...........................1-9
GPIB Error
Conditions ..........................1-9
Testing the 37XXXC GPIB Operation ...........1-10
1-6IEEE 488.2 SUMMARY ...............1-11
Chapter 1
Series 37XXXC 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 (371XXC, 372XXC,373XXC). The reader
needs to be aware of the feature set available within the model for
which programming is being written. Feature set information is docu
mented in the applicable operation manual (OM) for any particular
model.
1-2INTRODUCTIONThis chapter contains a brief introduction to the 37XXXC 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:
1-4REMOTE OPERATIONThe following paragraphs describe the 37XXXC facilities for remote
operation.
The 37XXXC fully supports the IEEE 488.2–1992 GPIB standard. All
37XXXC 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 37XXX VNA func
tions as both a listener and a talker.
-
37XXXC PM1-3
REMOTE OPERATIONGENERAL INFORMATION
GPIB Setup MenuThe 37XXXC VNA GPIB address defaults to 6. This value may be
changed via the Utility Menu key's GPIB ADDRESSES menu (below).
System State
Default
Program
Utility
Menu
Figure 1-1. GPIB Address Menu
SELECT UTILITY
FUNCTION OPTIONS
GPIB ADDRESSES
DISPLAY
INSTRU MENT
STATE PARAM S
GENERAL
DISK UTILITIES
CALIBRATIO N
COMPONENT
UTILITIES
COLOR
CONF IGU RAT ION
DATAON(OFF)
DRAWING
BLANKING
FREQUENCY
INFORM ATIO N
PRESS <ENTER>
TO SELECT
OR TURN ON/OFF
GPIB ADDRESSES
IEEE 488.2
GPIB INTERFACE
ADDRESS
6
DEDICATED
GPIB INTERFACE
EXTERNAL SOURCE
4
PLOTTER
8
POWER METER
13
FREQUENCY COUNTER
7
1-437XXXC PM
GENERAL INFORMATIONREMOTE OPERATION
y
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.
PrinterOut
CRTDegaussCRTBrt
10MHzRef
Display
VGAOUT
ExternalI/O
BiasFuses
ReferenceExtension
Port1 Port2
RAInRBIn RBOut
RAOut
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 37XXXC to control external GPIB
devices, such as a plotter,second frequency source, fre
NOTE
-
-
quency counter,or a power meter.
IEEE 488.2 Interface
Dedicated GPIB Interface
Displa
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 37XXXC to local
operation. Local operation will be restored unless the 37XXXC is pro
grammed for local lockout; the Local Lockout LED indicator will be lit.
789
3
6
45
Enter
123
10-3Clear
.
-
0
Channel
Setup
Auto
Scale
Trace
Memory
Clear
Ret Loc
Data
Menu
Points
Device
Domain
Hold
ID
Video
Option
Menu
IFBW
Avg/
Average
Smooth
Trac e
Smooth
Menu
Limits
Ch1 Ch2
Menu
Marker
Readout
Ch3 Ch4
Menu
Marker
Graph
Set
Menu
Type
Default
Utility
Program
Menu
Save/
Begin
Apply
Recall
Cal
Menu
Cal
Scale
Start
Stop
Ref
S
Plane
Params
Print
Print
-
37XXXC 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.Bitsare HIGH with the data is logical0andLOW 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.
8NDACNotData Accepted. Alow-truestate indicates that the current databytehas 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. Alow-true state indicates that abusinstrumentneeds service from
the controller.
11ATNAttention. A low-true state enables the controller to respond to both it's own lis
ten/talk address andtoappropriateinterfacemessages—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 37XXXC switches to remote (GPIB) control. It remains lit until the unit returns to local control.
Talk:
Lights when you address the 37XXXC to talk and remains lit until unaddressed to talk.
Listen:
Lights when you address the 37XXXC to listen and remains lit until
unaddressed to talk.
SRQ:
Lights when the 37XXXC sends a Service Request (SRQ) to the exter
nal controller. The LED remains lit until the 37XXXC 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
37XXXC 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.
-
37XXXC PM1-7
GPIB COMMUNICATIONGENERAL INFORMATION
1-5GPIB COMMUNICATIONThe following paragraphs present a short summary of 37XXXC GPIB
communication. Subjects covered are program messages, sepa
rator/termination characters,status reporting, and GPIB error condi
tions and corresponding 37XXXC responses. Refer to Chapter 7,
Remote-Only Operation, for detailed description of these topics.
The primary GPIB messages that effect 37XXXC 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 37XXXC response to them.
Table 1-1. IEEE-488 Interface Function Messages
Interface Function
Message
DCL
SDC
GTLGo To LocalYesReturns the 37XXXC to local (front panel) control.
GETGroup Execute Trig-
IFCInterface ClearNoStops the 37XXXC GPIB from talking/listening.
LLOLocal LockoutNoDisables the front panel RETURN TO LOCAL key.
RENRemote EnableNoPlaces the 37XXXC 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 37XXXC GPIB communication functions.
Resets the 37XXXC GPIB communication functions.
common command *DDT. A GET is also done by using the
*TRG command (see Chapter 10, Command Dictionary).
37XXXC VNA Response
-
-
37XXXC Specific
Messages
The 37XXXC specific GPIB messages (also known as commands, que
ries, and mnemonics) are used to control 37XXXC 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 37XXXC 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 37XXXC commands are three character contractions of their
functional descriptions.Examples include: OM1 (Output Marker 1),
1-837XXXC 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
37XXXC 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 37XXXC. 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 37XXXC GPIB messages is
the linefeed character (0A, decimal 10).
The 37XXXC 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.
37XXXC 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, sepa
raters or terminators that do not conform to correct IEEEE 488.2 for
mats. The 37XXXC 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 37XXXC
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 37XXXC 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 37XXXC error
messages (including GPIB errors).
The following test can be used to check your GPIB cable and 37XXXC
GPIB connectors.
1. Disconnect all GPIB cables from the 37XXXC.
2. Connect your GPIB cable between the two GPIB connectors on the
37XXXC 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-1037XXXC 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 37XXXC.
Table 1-2. 37XXXC IEEE 488.2 Standard Documentation Summary (1 of 3)
NumberRequirement ItemImplementation in VNA
1Interface Function Subsets ImplementedSH1, AH1, T6, L4, SR1, RL1, PP1, DC1, DT1, C0, E2.
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 37XXXC 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
-
-
37XXXC PM1-11
IEEE 488.2 SUMMARYGENERAL INFORMATION
Table 1-2. 37XXXC 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 limitations37XXXC 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
2. On execution, the 37XXXC returns a command error
and ignores the rest of the string.
1-1237XXXC PM
GENERAL INFORMATIONIEEE 488.2 SUMMARY
Table 1-2. 37XXXC 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
37XXXC PM1-13/1-14
Chapter 2
GPIB 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-7OPERATION TIME OUT...............2-8
Example......................2-8
2-8SENDING COMMANDS ...............2-9
Example: .....................2-9
37XXXC Commands Used ............2-9
2-9RECEIVING DATA .................2-10
Example:.....................2-10
Error Handling: .................2-10
37XXXC Commands Used ...........2-11
2-10SRQ 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 OPERATIONS............2-13
Example 1 ....................2-13
Example 2 ....................2-13
37XXXC Commands Used ...........2-14
Chapter 2
GPIB Programming
Basics
2-1INTRODUCTIONThis chapter contains a brief introduction to GPIB programming tech
niques and describes procedures to be used when preparing GPIB pro
grams for the 37XXXC VNA. It includes information about equipment
requirements and configuration for GPIB control of the 37XXXC VNA,
and many programming tips.
Familiarity with manual (front panel) operation of the 37XXXC is as
sumed. (Throughout this section, the 37XXXC VNA is referred to sim
ply as “37XXXC”.) A complete description of front panel operation is
contained in the appropriate 371XXC, 372XXC, or 373XXC Vector
Network Analyzer System Operation Manual.
2-2EQUIPMENT AND
CONFIGURATION
Required EquipmentThe following equipment represents a minimum GPIB controllable
The programming examples contained in this chapter assume the
equipment listed below is present and configured as described.
37XXXC VNA system:
q
A 37XXXC 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).
37XXXC PM2-3
EQUIPMENT AND CONFIGURATIONGPIB PROGRAMMING BASICS
y
To:
IEEE 488.2 Interface
From:
IEEE 488 Interface
card connector
Figure 2-1. Model 37XXXC Shown Connected to an IEEE 488.2 Controller
NOTE
The IBM PC and National Instruments GPIB interface
were chosen for demonstrating the 37XXXC GPIB operation in this manual. Any other GPIB controller that conforms to the IEEE 488 standard can be used to interface to
the 37XXXC.
connector
Prin te rOut
CRTDegaussCRTBrt
ConfigurationConfigure the 37XXXC as shown in Figure 2-1. Apply power to the
37XXXC and allow the system software to load from disk. Once the
10MHzRef
Dis pla y
VGAOUT
Exte rnalI/O
ReferenceExte nsio n
BiasFuses
Port1 Port2
RAInRBIn RBOut
RAOut
Connect here
Do not connect here
Displa
software has finished loading and start-up testing is complete, the
37XXXC is ready to be remotely controlled via the GPIB. It is impor
-
tant to note that the 37XXXC will not respond to GPIB commands un
til the 37XXXC system software has been loaded.
Connect a GPIB cable from the computer/controller to the rear panel
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 37XXXC (6) is assumed for all exam
-
-
-
ples in this chapter.
2-437XXXC 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).
-
-
37XXXC 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-637XXXC 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.
-
-
-
37XXXC PM2-7
OPERATION TIME OUTGPIB PROGRAMMING BASICS
2-7OPERATION TIME OUTSetting GPIB time out is necessary to allow for lengthy instrument op
erations to complete before the application program continues with its
processing. (Refer to paragraph 2-1, Waiting for Instrument Opera
tions 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-837XXXC PM
GPIB PROGRAMMING BASICSSENDING COMMANDS
2-8SENDING COMMANDSGPIB 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 37XXXC at address 6, the commands “CH2;DSP;MAG”, from
37XXXC 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
37XXXC 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.
37XXXC PM2-9
RECEIVING DATAGPIB PROGRAMMING BASICS
2-9RECEIVING 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 paragraph 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 37XXXC 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 37XXXC 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-1037XXXC PM
Loading...
+ 591 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.