Anritsu 37397D Programming Manual

SERIES
37XXXD
VECTOR NETWORK ANALYZER
PROGRAMMING MANUAL
490 JARVIS DRIVE · MORGAN HILL, CA 95037-2809
P/N: 10410-00262
REVISION: A
PRINTED: SEPTEMBER 2004
WARRANTY
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 specifica­tions 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 func­tion 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 PM i
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.
-
ii 37XXXD PM

Part 1 The GPIB 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-1 MANUAL SCOPE .........................1-3
1-2 INTRODUCTION .........................1-3
1-3 RELATED MANUALS.......................1-3
1-4 REMOTE OPERATION ......................1-3
GPIB Setup Menu ......................1-4
Interface Connection.....................1-5
Local Operation Key .....................1-5
Remote Operation LED Indicators .............1-7
1-5 GPIB 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-6 IEEE 488.2 SUMMARY .....................1-11
Chapter 1 Series 37XXXD GPIB Programmer Interface
1-1 MANUAL SCOPE This 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-2 INTRODUCTION This chapter contains a brief introduction to the 37XXXD GPIB inter-
face and programming environment.
1-3 RELATED MANUALS The 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 Title Part Number
37XXXD Operation Manual (OM) 10410-00261
37XXXD Maintenance Manual (MM) 10410-00264
37XXXD GPIB Quick Reference Guide 10410-00263
1-4 REMOTE OPERATION The 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 PM 1-3
REMOTE OPERATION GENERAL INFORMATION
GPIB Setup Menu The 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
DATA ON(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-4 37XXXD PM
GENERAL INFORMATION REMOTE OPERATION
Interface Connection Connect 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
a1 a2b1 b2
Ext
Trigger
Do not connect your external GPIB controller to the “Dedi
CAUTION
FORCONTINUEDFIRE PROTECTIONREPLACE ONLYWITHSPECIFIED TYPEANDRATEDFUSE.
-LINEINPUT 400VAMAX
48-63Hz
85-264VAC REPLACEFUSEONLYWITH SAMETYPEANDRATING
F U
S E
F U S
E
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 Key Press 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 PM 1-5
REMOTE OPERATION GENERAL 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
PIN NAME DESCRIPTION
1-4 DIO 1 thru DIO 4 Data 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.
7 NRFD Not Ready For Data. A high-true state indicates that valid data has not yet been ac
-
cepted by a listener.
8 NDAC Not Data Accepted. A low-true state indicates that the current data byte has been ac
-
cepted for internal processing by a listener.
9 IFC Interface 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.
10 SRQ Service Request. A low-true state indicates that a bus instrument needs service from
the controller.
11 ATN Attention. 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.
12 Shield Ground Point.
13-16 DIO 5 thru DIO 8 Data Input/Output. Bits are high with the data is logical 0 and LOW when the data is
logical 1.
17 REN Remote Enable. A low-true state enables bus instruments to be operated remotely,
when addressed.
18-
Figure 1-2. Pinout Diagram, IEEE 488.2 GPIB Connector
24
GND Logic ground.
1-6 37XXXD PM
GENERAL INFORMATION REMOTE OPERATION
.
-
Channels
Measurement
Display
Enhancement
GPIB
Remote
Talk
Listen
SRQ
Local Lockout
Remote Operation
LED Indicators
GPIB Remote Indicators (above) signal operational status of the GPIB, as described below:
Remote:
Lights when the 37XXXD switches to remote (GPIB) control. It re­mains lit until the unit returns to local control.
Talk:
Lights when you address the 37XXXD to talk and remains lit until un­addressed 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 Indicators A 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 PM 1-7
GPIB COMMUNICATION GENERAL INFORMATION
1-5 GPIB COMMUNICATION The 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
GTL Go To Local Yes Returns the 37XXXD to local (front panel) control.
GET Group Execute Trig-
IFC Interface Clear No Stops the 37XXXD GPIB from talking/listening.
LLO Local Lockout No Disables the front panel RETURN TO LOCAL key.
REN Remote Enable No Places the 37XXXD in remote when addressed to listen.
Message Function
Device Clear Selected Device Clear
ger
Addressed
Command
No
Yes
Yes Executes 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
-
-
tion. Refer to Chapter 10, Command Dictionary; Appendix B, Quick Refer
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-8 37XXXD PM
GENERAL INFORMATION GPIB 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 de­scribed 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 Instru­ment 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: semi­colon (;), comma (,), and space ( ) and their usage is shown below.
Character Used to separate
;
,
Space A 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 PM 1-9
GPIB COMMUNICATION GENERAL 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-10 37XXXD PM
GENERAL INFORMATION IEEE 488.2 SUMMARY
1-6 IEEE 488.2 SUMMARY Table 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)
Number Requirement Item Implementation in VNA
1 Interface Function Subsets Implemented SH1, AH1, T6, L4, SR1, RL1, PP1, DC1, DT1, C0, E2.
2 Device behavior when the user (unit) GPIB address
is set outside of the 0–30 range
3 When is a user address change recognized? New address is accepted and entry color remains
4 Description of settings at power-on The 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 PM 1-11
IEEE 488.2 SUMMARY GENERAL INFORMATION
Table 1-2. 37XXXD IEEE 488.2 Standard Documentation Summary (2 of 3)
Number Requirement Item Implementation in VNA
5 Message exchange options
a. Size and behavior of input buffer a. Default size = 3 KByte. Size increases to required
amount, as needed, for <Arbitrary Block> transfers.
b. Queries that return more than one <RE­SPONSE MESSAGE UNIT>
c. Queries that generate a response when parsed c. All d. Queries that generate a response when read d. None e. Commands that are coupled e. None
6 Functional 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.
-
-
-
7 Buffer size limitations 37XXXD Attempts to allocate amount required; sets
DDE error if not possible. (See 5a., above)
8 <PROGRAM DATA> elements that may appear
within an <expression>
9 Response syntax for queries See command descriptions.
10 Description of device-to-device message transfer
traffic that does not follow the rules for <RESPONSE MESSAGES>
11 Size of block data responses Variable, See command descriptions for details.
12 IEEE.488.2 Common commands and queries that
are implemented
13 State of VNA following the successful completion of
the Calibration query
14 Maximum length of the block used to define the trig
ger macro (1.) The method of interpreting *TRG within a *DDT command sequence (2.)
N/A (expressions are not used)
None
*CLS, *DDT, *DDT?, *ESE, *ESE?, *ESR?, *IDN?, *IST?, *OPC, *OPC?, *OPT?, *PRE, *PRE?, *RST, *SRE, *SRE?, *STB?, *TRG, *TST?, *WAI
Normal State
-
1. 255 characters.
2. On execution, the 37XXXD returns a command error and ignores the rest of the string.
1-12 37XXXD PM
GENERAL INFORMATION IEEE 488.2 SUMMARY
Table 1-2. 37XXXD IEEE 488.2 Standard Documentation Summary (3 of 3)
Number Requirement Item Implementation in VNA
15 Maximum 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.
16 Response to common query *IDN?. ANRITSU, <Model>, <SN>, <SW revision>
17 Size of the protected user data storage area, if the
*PUD command or *PUD? query are implemented.
18 Size of resource description, if the *RDT command
or *RDT? query are implemented.
19 States affected by *RST, *LRN?, *RCL, and *SAV. *RST = default state (see Chapter 11),
20 Scope of the self test performed by *TST? command. Fully automated internal hardware testing/reporting.
21 Additional status data structures used in status re-
porting.
22 Statement describing whether each command is
overlapped or sequential.
23 Functional 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 non­volatile service log for user access.
Limits Event Status and Extended Event Status regis­ters; refer to Chapter 7 for details.
All commands are sequential.
N/A – No overlapped commands.
24 Descriptions used for infinity and not-a-number. N/A
37XXXD PM 1-13/1-14
Chapter 2 GPIB and Ethernet Programming Basics
Table of Contents
2-1 INTRODUCTION .........................2-3
2-2 EQUIPMENT AND CONFIGURATION .............2-3
Required Equipment.....................2-3
Configuration.........................2-4
2-3 GPIB PROGRAM ELEMENTS ..................2-5
National Instruments GPIB Interface ...........2-5
Definitions ..........................2-5
2-4 INITIALIZING THE GPIB ....................2-6
2-5 SHUTTING DOWN THE GPIB SYSTEM ............2-6
2-6 DETECTING GPIB ERRORS...................2-7
Full Error Detection .....................2-7
Limited Handling Error Detection .............2-7
NI488 Global Variables ...................2-7
Example ...........................2-7
2-7 GPIB OPERATION TIME OUT..................2-8
Example ...........................2-8
2-8 SENDING GPIB COMMANDS ..................2-9
Example: ...........................2-9
37XXXD Commands Used..................2-9
2-9 RECEIVING GPIB DATA ....................2-10
Example: ..........................2-10
Error Handling:.......................2-10
37XXXD Commands Used .................2-11
Table of Contents (Continued)
2-10 GPIB 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-11 COMPLETE GPIB OPERATIONS ...............2-13
Example 1..........................2-13
Example 2..........................2-13
37XXXD Commands Used .................2-14
2-12 ETHERNET PROGRAMMING .................2-15
Ethernet and GPIB Differences ..............2-15
Ethernet Communication Steps ..............2-16
Example Program......................2-23
2-2 37XXXD PM
Chapter 2 GPIB and Ethernet Programming Basics
2-1 INTRODUCTION This 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-2 EQUIPMENT AND
CONFIGURATION
Required Equipment The 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 Ana­lyzer 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 PM 2-3
EQUIPMENT AND CONFIGURATION GPIB 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 opera­tion in this manual. Any other GPIB controller that con­forms to the IEEE 488 standard can be used to interface to the 37XXXD.
Connector
NOTE
.
-
Channels
Measurement
Display
Enhancement
Configuration Configure the 37XXXD as shown in Figure 2-1. Apply power to the
37XXXD and allow the system software to load from disk. Once the
GPIB
IEEE488.2
Refertomanual
SR1
RL1
T6
L4
SH1
AH1
E2
C0
DC1
DT1
Dedicated
Peripherals
Communications
PP1
GPIB
WARNING
NOOPERATORSERVICE-
ABLEPARTSINSIDE.
REFERSERVICINGTO QUALIFIEDPERSONNEL.
forGPIBAddress
CAUTION
>18Kg
HEAVYWEIGHT
IEEE488.2
SH1
AH1
T6
L4
ExternalSCSI-2Hard DiskDrive
10MHzRef
In 5dBm50
Ext
Ext
AnlgOut
AnlgIn
ExternalI/O
BiasFuses
Port1
F
U S E
E S U
F
U
F
S E
F.5A250V
GPIB
SR1
RL1
PP1
DC1
DT1
C0
E2
GPIB connector
GPIB
Dedicated
TestSet
ControlOut
CAUTION
TerminateUnused
+20dBMMAX,0VDC
Inputs
AVOIDSTATICDISCHARGE
IFInputs<270 MHz
Out 5dBm50
a1 a2b1 b2
Ext
Trigger
CAUTION
FORCONTINUEDFIRE PROTECTIONREPLACE ONLYWITHSPECIFIED TYPEANDRATEDFUSE.
-LINEINPUT 400VAMAX
48-63Hz
85-264VAC REPLACEFUSEONLYWITH SAMETYPEANDRATING
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-4 37XXXD PM
GPIB PROGRAMMING BASICS GPIB PROGRAM ELEMENTS
2-3 GPIB 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 proce­dures and function calls in your program. Also, the file named gpib.com must be installed in memory upon bootup of your com­puter. 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 inter­face 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.
Definitions The 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 PM 2-5
INITIALIZING THE GPIB GPIB PROGRAMMING BASICS
2-4 INITIALIZING THE GPIB Initializing 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-5 SHUTTING 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-6 37XXXD PM
GPIB PROGRAMMING BASICS DETECTING GPIB ERRORS
2-6 DETECTING GPIB
ERRORS
Full Error Detection Full 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,er­rors, 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 op­eration. IBCNTL is the “long integer” version of IBCNT.
Example Error 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 PM 2-7
GPIB OPERATION TIME OUT GPIB PROGRAMMING BASICS
2-7 GPIB 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.)
Example The 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-8 37XXXD PM
Loading...
+ 640 hidden pages