ChapterSummary3-2
Where to Find Some Specific Information3-2
Where to FindBASIC Programming Examples3-3
Where to Find QuickBASIC Programming Examples3-3
Where to Find Turbo C Programming Examples3-3
Configuring the GPIB3-4
ToSettheGPIBModeandAddress3-4
To Connect the Counter to a Computer3-6
Remote/Local Operation3-6
Overview of Command Types and Formats3-7
Common Command Format3-7
SCPI Command and Query Format3-7
Response Messages3-16
Response Message Syntax3-16
Response Message Data Types 3-17
Status Reporting3-19
Status Byte Register and Service Request Enable
Register 3-21
Status Byte Register3-21
Service Request Enable Register3-23
Standard Event Status Register Group3-24
Standard Event Status Register3-24
Standard Event Status Enable Register3-26
Operation Status Register Group and Questionable Data/Signal Status
Register Group3-27
Condition Register3-28
Transition Filter3-28
Event Register3-29
Event Enable Register3-29
Operation Status Register Group3-30
Questionable Data/Signal Status Register Group3-32
Command Settings for Optimizing Throughput3-35
Commands to Set Counter for Optimal Throughput3-35
Typical Optimizing Throughput Results for Different Computers3-37
How to Program the Counter for Status Reporting3-38
Determining the Condition of the Counter3-38
Resetting the Counter and Clearing the GPIB
Interface—Example 13-38
Using the Standard Event Status Register to Trap an Incorrect GPIB
command—Example 23-39
Event Status Register3-39
Using the Questionable Data/Signal Status Register to Alert the
Computer When Automatic Interpolator Calibration is Disabled—
Example 33-39
Questionable Data Status Register3-40
Page 9
Using the Operation Status Register to Alert the Computer When
Measuring has Completed—Example 43-40
Operation Status Register3-40
How to Program the Counter to Display Results3-43
Configuring the Counter’s Display3-43
Commands for Displaying Non-Scaled/Offset Results3-43
Commands for Displaying Scaled/Offset Results3-44
Commands for Displaying the Limit Graph3-44
Commands for Displaying Statistics Results3-44
Commands for Enabling and Disabling the Display3-45
How to Program the Counter to Synchronize Measurements3-46
Synchronizing Measurement Completion3-46
Resetting the Counter and Clearing the GPIB Interface3-46
Using the *WAI Command3-46
Using the *OPC? Command3-47
Using the *OPC Command to Assert SRQ3-48
How to Program the Counter for Math/Limit
Operations3-49
Updating Math and Limit Results Over GPIB3-49
Using the Scale and Offset Over GPIB3-50
How to Program the Counter to Define Macros3-52
Writing SCPI Programs3-55
Programming Examples3-58
UsingBASIC3-58
To Send a Double-Quoted String3-58
To Send a Single-Quoted String3-58
Using QuickBASIC3-59
Using Turbo C3-59
List of the Programming Examples3-59
Easiest Way to Make a Measurement (BASIC)3-60
To Make a Frequency Measurement (BASIC)3-62
To Perform Limit Testing (BASIC)3-63
To Measure the Statistics of 50 Measurements
(BASIC)3-64
Page 10
To Use Limits to Filter Data Before Measuring Stats
(BASIC)3-66
To Read and Store Calibration Information
(BASIC)3-68
ToPerformaTimeIntervalCalibration(BASIC)3-69
To Optimize Throughput (BASIC)3-73
To Use Macros (BASIC) 3-75
To Make a Frequency Measurement (QuickBASIC)3-77
To Perform Limit Testing (QuickBASIC)3-78
To Measure the Statistics of 50 Measurements
(QuickBASIC)3-80
To Use Limits to Filter Data Before Measuring Stats (QuickBASIC)3-
82
To Read and Store Calibration Data (QuickBASIC)3-85
To Optimize Throughput (QuickBASIC)3-86
To Use Macros (QuickBASIC)3-88
To Make a Frequency Measurement (Turbo C)3-91
To Use Limits to Filter Data Before Measuring Statistics (Turbo C)3-
Introduction5-2
Displaying Errors5-2
Reading an Error5-2
Error Queue5-3
Error Types5-4
No Error5-4
Command Error5-4
Execution Error5-5
Device- or Counter-Specific Error5-5
Query Error5-6
Page 14
Page 15
1
1
Before You Start ...
Page 16
Chapter 1 Before You Start ...
Introduction
Introduction
This programming guide contains programming information for the
Agilent 53131A/132A Universal Counter.
This guide assumes you are familiar with the front-panel operation of the
Counter. See the Agilent 53131A/132A Operating Guide for detailed information
about front-panel operation. You should use this programming guide together
with the operating guide. Knowing how to control the Counter from the front
panel and understanding the measurements you wish to perform makes the
programming task much easier. The operating guide provides explanations and
task procedures for all of the Counter’s measurement functions, and contains the
specifications for the Counter.
By sending Standard Commands for Programmable Instruments (SCPI)
commands, all of the Counter’s front-panel functions can be remotely operated
via the General Purpose Interface Bus (GPIB),
as well as the additional throughput optimizing function not available from the
front panel.
This Counter programming commands conform to the Standard Commands forProgrammable Instruments (SCPI) Standard Version 1992.0. The SCPI standard
does not completely redefine how to program instruments over the General
Purpose Interface Bus (GPIB). However, it does standardize the structure and
content of an instrument’s command set to reflect the best programming
practices developed by people using GPIB. It also establishes standard command
mnemonics for similar functions in all of the instruments that conform to the
SCPI standard.
If you have programmed any Agilent instruments that have been released over
the last few years, you will have seen a general trend toward the techniques
specified in the SCPI standard. For example, several instruments are already
using a hierarchy of commands that is similar to the command structure defined
by the SCPI standard.
1-2Programming Guide
Page 17
Chapter 1
Differences Between Prior and Current Revisions
of the Agilent 53131A/132A
If you have an Agilent 53131A containing one of the prior firmware revisions
(3317, 3335, or 3402), read the subsection below titled “Agilent 53131A
Containing Firmware Revisions (3317, 3335, or 3402)” to get an overview of the
differences between the earlier firmware revisions and current firmware revision.
If you have an Agilent 53132A with a serial number prefixbelow 3646, read the
subsection titled “Agilent 53132A Time Interval Delay Arming” on page1-5.
NOTE
Note that throughout the guide, differences between the earlier and current
firmware revisions are noted where applicable.
Agilent 53131A Containing Firmware Revisions (3317, 3335, or
3402)
There are four main areas that differ:
● Calibrations
● Measurements
● Statistics
● GPIB Commands
Calibrations
If your Counter contains other than the current firmware revision, the following
calibration features are different:
● The calibration functions are in the Utility menu instead of the Calibration
menu, which is accessed by pressing and holding the front-panel Utility key
and then cyclingPOWER key.
● Calibrations are not protected by a security code.
● A calibration count does not exist to aid in monitoring the number of
calibrations performed.
● A more accurate Time Interval calibration (FINE TI) is not available.
See the section titled “Using the Calibration Menu” in Chapter 2 of the Agilent53131A/132A Operating Guide for details.
Programming Guide1-3
Page 18
Chapter 1 Before You Start ...
Differences Between Prior and Current Revisions of the Agilent
53131A/132A
Measurements
If your Counter contains other than the current firmware revision, the following
measurement capabilities are different:
● Ratio channel selections Ratio 2 to 1 and Ratio 3 to 1
(for those counters equipped with Channel 3) are not available.
● Ratio “AUTO-armed” does not automatically extends gate to capture
sufficient edges.
If Channel 1 input frequency is less than approximately 10 Hz, the Ratio
gate time isnot extended to capture sufficient Channel 1 edges to
produce a valid measurement. Default gate time is 100 msec, which is
not long enough to capture two edges on a low-frequency signal.The
user is required to extend the gate by switching to TIME arming, and
selecting a gate time appropriately long.
● Sensitivity for firmware revision below does not have adjusted controls to
LO and MED sensitivity.
In some Counters that contained firmware revision 3317,
LO sensitivity fails to correctly count very high frequency signals.
Statistics
If your Counter contains other than the current firmware revisions, single-shot
statistics are not available using the ON SINGLE:menu item found in the
Statistics menu (use Stats key).
GPIB Commands
[:SENSe]:EVENt[1|2}:HYSTeresis:RELative
If your Counter contains firmware revisions 3402 and below, the input hysteresis
command and query does not operate in the conventional way. That is,
[:SENSe]:EVENt[1|2]:HYSTeresis:RELative sets high sensitivity when the
parameter is MINimumor 0 percent, and sets low sensitivity when the parameter
is MAXimum or 100 percent.
In the prior firmware revisions (3317, 3335, or 3402), MINimum or 0 percent
corresponded to low sensitivity, and MAXimum or 100 percent corresponded to
high sensitivity.
If your Counter contains firmware revisions 3402 and below, the Totalize
Measurement Instruction commands (shown above) are not available to disable
auto-trigger.
In the firmware revisions 3402 and below, these commands enabled auto-trigger
at the 50% level.
Agilent 53132A Time Interval Delay Arming
Agilent 53131A and Agilent 53132A Counters with a serial number prefix below
3646 are identical in their TI arming modes. Both only offer Time Interval
Delay, where the STOP trigger of a time interval measurement can be delayed by
a user-specified time.
Programming Guide1-5
Page 20
Chapter 1 Before You Start ...
Getting Started
Getting Started
Before attempting to program the Counter, take some time to familiarize yourself
with the content of this guide. The remainder of this chapter contains the
following information:
● An explanation of how you should use the programming guide based on
your experience programming instruments and your testing requirements.
● A description of the guide contents.
● A statement of assumptions that are made in the guide.
● A list of related documentation.
How to Use This Guide
How you use this guide depends upon how much you already know about
programming instruments and how complex your measurement requirements are.
Let’s start by establishing your programming background, and then discuss the
type of measurements you want to perform.
New Users
What You Should Understand
As a new user, you should understand that you must have some understanding of
a high-level language such as Pascal, BASIC, C, or FORTRAN before you can
use the command set defined in this guide to control the Counter. (In Chapter 3,
“Programming Your Universal Counter for Remote Operation,” there are
programming examples provided in BASIC, MicrosoftÒ QuickBASIC, and
BorlandÒ Turbo C.) However, whatever language you use, command strings
that control the Counter remain the same.
1-6Programming Guide
Page 21
Chapter 1
Learning to Program the Counter
To learn how to program the Counter, perform the following:
● Scan the summary tables in Chapter 2, “Command Summary,”
to get a feeling for the number and structure of commands available to you.
● Read and study map drawings in the section titled “Front Panel to SCPI
Command Maps” in Chapter 2.
● Read Chapter 3, “Programming Your Universal Counter for Remote
Operation,” for an overview of the SCPI concepts as they relate to the Agilent
53131A/132A Universal Counter. Look at the flowcharts, which illustrate some
of the decisions you must make when programming the Counter.
● Read the section at the end of Chapter 3 titled “Programming Examples for
Making Common Measurements,” which provides programming examples.
● Modify some of the programming examples to select specific measurement
functions. If the programs work, consider yourself an experienced programmer
and use Chapter 4, “Command Reference,” as a reference for detailed
information of all the Counter’s SCPI commands.
Experienced Programmers
If you have programmed other GPIB instruments, you will probably be familiar
with many of the concepts and techniques discussed in this guide. Also, you will
find that using the SCPI commands is very similar to using the older GPIB
commands. The main difference is the hierarchy of the subsystem commands.
(However, this type of structure has been previously used on other instruments.)
Because the SCPI command set and some of the status reporting techniques are
new, you may want to use the following sequence to learn the Counter
programming requirements:
● Look over the steps for a new user and perform any that you think are
applicable to your current level of knowledge. In particular, look at the
measurement techniques and examples provide in Chapter 3, “Programming
Your Universal Counter for Remote Operation.”
● Review the summary tables in Chapter 2, “Command Summary.” If this
chapter contains sufficient information to get you started, write some programs
to explore the Counter’s capabilities. If you need additional information on any
command, refer to the applicable command description in Chapter 4, “Command
Reference.”
● Review the remaining information in this guide to determine what is
applicable to your programming requirements.
Programming Guide1-7
Page 22
Chapter 1 Before You Start ...
How to Use This Guide
If you need more information than is contained in this guide, see the section in
this chapter titled “Related Documentation.”
Applications
After you have read the appropriate information and written some measurement
programs, you may want to expand the scope of your applications. The following
two techniques are explained in detail:
● If you are going to write interrupt-driven programs (or if you just want to
determine the status of the Counter), read the section titled “Status Reporting” in
Chapter 3.
● If you are going to write programs to transfer data between the Counter and an
external computer, read the sections titled “Overview of Response Message
Formats,” and “Command Settings for Optimizing Throughput” in Chapter 3.
1-8Programming Guide
Page 23
Chapter 1
Programming Guide Contents
The following information is contained in this guide:
● Table of Contents
● Chapter 1 (this chapter) ,“Before You Start,” is a preface that introduces you
to the programming guide.
● Chapter 2, “Command Summary,” is a quick reference that summarizes the
Counter’s programming commands. It provides you with front-panel to SCPI
command maps, SCPI conformance information, and command summary tables.
● Chapter 3, “Programming Your Universal Counter for Remote
Operation,” describes how to set up the Counter for remote operation, briefly
explains the SCPI elements and formats, describes status reporting, describes
how to write programs,
and provides programming examples for each of the main tasks that you will
want your Counter to perform.
● Chapter 4, “Command Reference,” is a dictionary that describes the SCPI
subsystems and IEEE 488.2 Common commands.
● Chapter 5, “Errors,” lists all the error messages the Counter can generate and
what caused the error.
● Index
Assumptions
This guide assumes the Counter is correctly installed and interfaced to an
external computer. If it is not, see IEEE GPIB Interconnection information in
Agilent Technologies, Tutorial Description of the General Purpose Interface
Bus, 1987.(See the following section in this chapter titled “Related
Documentation” for ordering information.)
As previously mentioned, this guide also assumes you are familiar with the frontpanel operation of the Counter. See the Agilent 53131A/132A Operating Guide
for detailed information about front-panel operation. Knowing how to control the
Counter from the front panel and understanding the measurements you wish to
perform makes the programming task much easier.
Programming Guide1-9
Page 24
Chapter 1 Before You Start ...
Related Documentation
Related Documentation
This section contains a list of documentation related to the use of the Counter.
Additional information that you may find useful can be found in the following
publications:
1. Agilent 53131A/132A Operating Guide(Agilent Part Number
53131-90043)
2. Beginner’s Guide to SCPI (Agilent Part Number H2325-90002, July
1990 Edition).
3. Beginner’s Guide to SCPI, Barry Eppler (Hewlett-Packard Press,
Addison-Wesley Publishing Co. 1991).
4. Standard Commands for Programmable Instruments (SCPI), Version
1992.0.
This standard is a guide for the selection of messages to be included in
programmable instrumentation. It is primarily intended for instrument
firmware engineers. However, you may find it useful if you are
programming more than one instrument that claims conformance to the
SCPI standard.
You can verify the use of standard SCPI commands in different
instruments.
To obtain a copy of this standard, contact:
SCPI Consortium
8380 Hercules, Suite P3
La Mesa, CA 91942
Phone: (619) 697-8790
FAX: (619) 697-5955
5. The International Institute of Electrical Engineers and Electronic
Engineers, IEEE Standard 488.1-1987, IEEE Standard Digital Interface
for Programmable Instrumentation.
This standard defines the technical details required to design and build
an GPIB (IEEE 488.1) interface. This standard contains electrical
specification and information on protocol that is beyond the need of
most programmers. However, it can be useful to clarify formal
definitions of certain terms used in related documents.
1-10Programming Guide
Page 25
Chapter 1
To obtain a copy of this standard, write to:
The Institute of Electrical and Electronic Engineers Inc.
345 East 47th Street
New York, NY 10017 USA
6. The International Institute of Electrical Engineers and Electronic
Engineers, IEEE Standard 488.2-1987, IEEE Standard Codes, Formats,
Protocols, and Common Commands for Use with ANSI/IEEE Std 488.11987 Programmable Instrumentation.
This standard defines the underlying message formats and data types
used in SCPI. It is intended more for firmware engineers than for
instrument users/programmers. However, it can be useful if you need to
know the precise definition of specific message formats, data type, or
common commands.
To obtain a copy of this standard, write to:
The Institute of Electrical and Electronic Engineers Inc.
345 East 47th Street
New York, NY 10017 USA
This BASIC manual contains a good non-technical description of the
GPIB (IEEE 488.1) interface in Chapter 12, “The GPIB Interface.”
Subsequent revisions of BASIC may use a slightly different title for this
manual or chapter.
This manual is the best reference on I/O for BASIC programmers.
To obtain a copy of this manual, contact your nearest
Agilent Technologies Sales office.
8. Agilent Technologies, Inc., Tutorial Description of the
General Purpose Interface Bus, 1987.
To obtain a copy of this manual, contact your nearest
Agilent Technologies Sales office.
Programming Guide1-11
Page 26
Chapter 1 Before You Start ...
Related Documentation
1-12Programming Guide
Page 27
2
2
Command Summary
A Quick Reference
Page 28
Chapter 2 Command Summary
Introduction
Introduction
This chapter is a quick reference that summarizes the Counter’s programming
commands.
Chapter Summary
● Front Panel to SCPI Command Maps
– Some SCPI Syntax Conventionspg. 2-3
– Input Channels Conditioning Keys to SCPI
Command Mappg. 2-4
– Instrument Control, Utility, Recall, and
Save & Print Keys to SCPI Command Mappg. 2-6
– MEASURE Keys to SCPI Command Mappg. 2-8
– Gate & ExtArm Key to SCPI Command Mappg. 2-10
The section titled “Front Panel to SCPI Command Maps,” provides maps that show the front-panel
keys and their corresponding (or related) SCPI commands.
2
The section titled “Agilent 53131A/132A Command Summary,” lists the IEEE 488.2 Common and
the SCPI Subsystem commands in tables 2-1and 2-2, respectively.
3
The section titled*RST Response, lists the states of all of the commands that are affected by the
RST command in Table 2-3. This section also lists commands that are unaffected by*RST in
*
Table 2-4.
2-2Programming Guide
Page 29
Chapter 2
Front Panel to SCPI Command Maps
Figures 2-1 through 2-6 provide maps that show the one-to-one relationship of
the front-panel keys and the SCPI commands. These maps should help with
identifying commands if you are already familiar with the front panel.
Some SCPI Syntax Conventions
[ ]An element inside brackets is optional. Note, the
brackets are NOT part of the command and should NOT
be sent to the Counter.
1 | 2Means use either 1 or 2.
<numeric_value>Means enter a number.
SENSeMeans you MUST use either all the upper case letters or
the entire word. The lower case letters are optional. For
example, SENS and SENSE are both valid. However,
SEN is not valid. (Note SENSe is used here as an
example, but this convention is true for all SCPI
commands.)
NOTE
When you see quotation marks in the command’s parameter
(shown in the “Parameter Form” column in Table 2-2), you must send the
quotation marks with the command. Refer to the section titled “Using BASIC” in
Chapter 3 (page 3-61) of this guide for details on how to use double quotes or
single quotes to enclose the string parameter of a command.
Programming Guide2-3
Page 30
Chapter 2 Command Summary
Front Panel to SCPI Command Maps
Input Channels Conditioning Keys to SCPI Command Map
_____________________________
*For TI 1 TO 2 (Time Interval measurements) only.
**Channel 3 is optional.
Figure 2-1. Input Channels Conditioning Keys to SCPI Command
Map (Part 1 of 2)
2-4Programming Guide
Page 31
Chapter 2
Input Channels Conditioning Keys to SCPI Command Map
(Cont.)
Since the primary purpose of these front-panel keys is to change the function, the
corresponding [:SENSe]:FUNCtion[:ON] command is listed in the menu map
above. The front-panel keys, however, invoke couplings which affect other
settings, whereas the [:SENSe]:FUNCtion[:ON] command does not.
Figure 2-3. MEASURE Keys to SCPI Command Map (Part 2 of 2)
The Calibration Menu is accessed by holding the Scale & Offset key and
cycling POWERkey.
Figure 2-6. Calibration Menu to SCPI Command Map (Part 2 of 2)
Programming Guide2-19
Page 46
Chapter 2 Command Summary
Agilent 53131A/132A Command Summary
Agilent 53131A/132A Command Summary
This section summarizes both the IEEE 488.2 Common and
Agilent 53131A/132A Standard Commands for Programmable Instruments
(SCPI) commands in tabular format. IEEE 488.2 Common commands are listed
first, followed by SCPI commands.
SCPI Conformance Information
The SCPI commands used in the Agilent 53131A/132A are in conformance with
the SCPI Standard Version 1992.0. The SCPI command set consists of the
following:
● Common commands as defined in IEEE 488.2-1987—listed and summarized
in Table 2-1.
● SCPI Subsystem commands as confirmed (and listed) in the SCPI Standard—
the commands defined in Table 2-2 as “Std.”
● SCPI Subsystem commands designed for the instrument in conformance with
SCPI standards but not yet listed in the SCPI Standard—the commands defined
in Table 2-2 as “New.”
Details of all Agilent 53131A/132A commands can be found in Chapter 4,
“Command Reference” of this programming guide.
Information on the SCPI commands format, syntax, parameter, and response
types is provided in Chapter 3, “Programming Your Universal Counter for
Remote Operation,” of this programming guide.
2-20Programming Guide
Page 47
Chapter 2
IEEE 488.2 Common Commands
The Common Commands are general purpose commands that are common to all
instruments (as defined in IEEE 488.2). Common Commands are easy to
recognize because they all begin with an “*” (for example, *RST, *IDN?,
*OPC). These commands are generally not related to measurement
configuration. They are used for functions like resetting the instrument,
identification, or synchronization.
Table 2-1 lists the Common Commands in alphabetical order by mnemonic,
name and function. More information concerning the operation of IEEE 488.2
status reporting commands and structure can be found in the “Status Reporting”
section of Chapter 3. Standard explanations of the IEEE 488.2 Common
commands can be found in the ANSI/IEEE Std. 488.2-1987, IEEE StandardCodes, Formats, Protocols, and Common Commands document.
Programming Guide2-21
Page 48
Chapter 2 Command Summary
Agilent 53131A/132ACommand Summary
Table 2-1. IEEE 488.2 Common Commands
MnemonicCommand NameFunction
*CAL?
*CLS
*DDT <arbitrary block>
*DMC <string>,
<arbitrary block>
*EMC <NRf>
*EMC?
*ESE <NRf>
*ESE?
Calibration
Clear Status
Define Device Trigger Command
Define Macro Command
Enable Macro Command
Enable Macro Query
Standard Event Status Enable
Standard Event Status Enable
Query
Causes the Counter to perform an internal interpolator selfcalibration and returns a response that indicates whether or
not the instrument completed the self-calibration without
error.
Clears Status data structures (Event Registers and Error
Queue).
Defines either INIT, FETC?, READ?, or nothing to be
executed when the Counter receives a GET or *TRG
command.
Assigns a sequence of zero or more commands/queries to a
macro label.
No query form.
Enables and disables expansion of macros.
Non-zero value enables; zero value disables.
Queries whether macros are enabled.
Sets the Standard Event Status Enable Register.
Queries the Standard Event Status Enable Register.
*ESR?
*GMC? <string>
*IDN?
*LMC?
*OPC
*OPC?
Note: Pending operations include measurements in progress.
Event Status Register Query
Get Macro Contents Query
Identification Query
Learn Macro Query
Operation Complete
Operation Complete Query
2-22Programming Guide
Queries the Standard Event Status Register.
Queries the current definition of a currentlydefined macro
label.
Queries the Counter identification.
Queries the currently defined macro labels.
Causes Counter to set the operation complete bit in the
Standard Event Status Register when all pending operations
(see Note) are finished.
Places an ASCII “1” in the Output Queue when all pending
operations (see Note) are completed.
Page 49
Chapter 2
Table 2-1. IEEE 488.2 Common Commands (Continued)
MnemonicCommand NameFunction
*OPT?
*PMC
*RCL <NRf>
*RST
*SAV <NRf>
*SRE <NRf>
*SRE?
*STB?
*TRG
Option Identification Query
Purge Macro Command
Recall
Reset
Save
Service Request Enable
Service Request Enable Query
Status Byte Query
Trigger
Identifies the options installed in the Counter.
Deletes all macros previously defined using the
*DMC command.
Restores the state of the Counter from a copy stored
in local non-volatile memory (0 through 20 are valid
memory registers).
Resets the Counter to a known state.
Stores the current state of the Counter in local nonvolatile memory (1 through 20 are valid memory
registers).
Set the Service Request Enable register.
Queries the Service Request Enable register.
Queries the Status Byte and Master Summary Status
bit.
This trigger command is the device-specific analog of
the IEEE 488.1 defined GET.
It initiates measurement, unless *DDT was used to
redefine device trigger.
*TST?
*WAI
Note: Pending operations include measurements in progress.
Self-Test Query
Wait-to-Continue
Programming Guide2-23
Executes an internal self-test and reports the results.
Makes Counter wait until all pending operations (see
Note) are completed before executing commands
following *WAI command.
Page 50
Chapter 2 Command Summary
Agilent 53131A/132ACommand Summary
Agilent 53131A/132A SCPI Subsystem Commands
SCPI Subsystem commands include all measurement functions and some general
purpose functions. SCPI Subsystem Commands use a hierarchy relationship
between keywords that is indicated by a “:” (colon). For example, in the
SYST:ERR? query, the “:” between SYST and ERR? indicates ERR? is
subordinate to SYST.
Table 2-2 lists the SCPI Subsystem Commands in alphabetical order by the
command keyword. The table shows the Subsystem commands hierarchical
relationship, related parameters (if any), and any associated information and
comments.
Not all commands have a query form. Unless a command is specified as “No
Query” or “Query Only” in the “Comments” column of Table 2-2, it has both
a command and a query form. Any command in the table that is shown with a
“?” at the end,
is a “Query Only” command.
Std/New Column
The Std/New column in Table 2-2 gives the status of the command with respect
to the SCPI standard. The “Std” commands operate as defined in the SCPI
standard and as defined in this guide.
The category of “New” consists of commands that could be:
● SCPI approved but are not yet in the SCPI manual
● Agilent approved and submitted for SCPI approval.
● Not approved at all.
The “New” commands operate as defined in this guide.
Parameter Form Column
Refer to the section titled “Parameter Types” on page 3-11 in Chapter 3,
“Programming Your Universal Counter for Remote Operation,” for descriptions
of the different parameter types (such as <Boolean>, <NRf>, <arbitrary block>,
etc.).
*The only functions which can be derived (using FETC? or READ?) from the stored data are
period to/from frequency, maximum to/from minimum, maximum to/from peak-to-peak, and
minimum to/from peak-to-peak. All other functions require an acquisition of a new type.
**<source_list> has the same syntax as SCPI <channel _list> syntax. For example, a
single-channel function (e.g., frequency, period, etc.) woulduse (@1) to specify channel 1,
whereas a two-channel function (e.g., time interval, phase, and frequencyratio) would use
(@1), (@2) to specify a measurement between channel 1 and channel 2.
***For Agilent 53131A firmware revisions below 3335, only Ratio 1 to 2 and Ratio 1 to 3 were
offered.
****This <function> is only allowed with :CONFigure.
Subtree. Queries the characteristics of the “trigger
event” for channel 3 input.
Subtree.
Query only. Returns the channel 3 input trigger level.
Query only. Returns the edge of the channel 3 input
that will be considered an event.
Subtree. Controls the frequency, frequency ratio, and
period measuring capabilities of the instrument.
Subtree. Synchronizes the frequency start and stop
arm with events.
Subtree.
Sets the slope of the external start arm signal used in
external arming frequency, frequency ratio, and
period measurements. Only applies when
[:SENS]:FREQ:ARM[:STAR]:SOUR EXT is selected.
Sets the start arm for frequency, frequency ratio, and
period measurements.
Subtree.
Sets the resolution in terms of digits used in arming
frequency, frequency ratio, and period
measurements. Only applies when
[:SENS]:FREQ:ARM:STOP:SOUR DIG is selected.
Sets the slope of the external stop arm signal used in
external arming frequency, frequency ratio, and
period measurements. Only applies when
[:SENS]:FREQ:ARM:STOP:SOUR EXT is selected.
Sets the stop arm for frequency, frequency ratio, and
period measurements.
Sets the gate time used in arming frequency,
frequency ratio, and period measurements. Only
applies when [:SENS]:FREQ:ARM:STOP:SOUR TIM
is selected.
Specifies the approximate frequency of a signal you
expect to measure at channel 1, 2, or 3.
Configures Counter to perform a pre-measurement
step to automaticallydetermine the approximate
:DTRIBFull | ON | LIMitStdSets the usage of the DTR line of the RS-232
:TRANsmitStdSubtree. Affects parameters associated with
:BAUD<numeric_value>StdSets the baud rate.
:PACEXON | NONEStdSets the software pacing scheme.
:PARityStdSubtree. Controls the parity of the channel.
[:TYPE]EVEN | ODD | NONEStdSets the parity scheme.
:ERRor?StdQuery only. Queries the oldest error in the Error
:KEY<numeric_value>StdSimulates the pressing of a front-panel key.
Std
Std
Std
Comments
Subsystem. Collects the functions that are not
related to instrument performance.
Subtree. Collects together configuration of
control/communication interfaces.
Subtree. Controls the physical configuration of
the RS- 232C port.
port.
transmission.
Queue and removes the error from the queue
(first in, first out).
:LOG?NewQuery only. Returns a comma-separated list of
integers representing all of the entries in the
Key Queue.
:VERSion?StdQuery only. Returns the SCPI version number
with which the Counter complies.
:TRACe
:CATalog?
[:DATA]
[:DATA]
[:DATA]?
[:DATA]?
:TRIGger
:COUNt
:AUTO
OFFSET, <numeric_value> [HZ
| S | DEG]
SCALE, <numeric_value>
OFFSET
SCALE
<Boolean>
Std
Std
Std
Std
Std
Std
Std
Std
New
Subsystem.
Query only. Returns list of intrinsic constants.
Sets the offset value.
Sets the scale value.
Queries the offset value.
Queries the scale value.
Subsystem.
Subtree.
Controls the number of measurements to be
made when :INIT[:IMM] is performed.
Programming Guide2-37
Page 64
Chapter 2 Command Summary
Agilent 53131A/132ACommand Summary
Table 2-2A. Agilent 53132A (S/N Prefix 3646 and Above) Time Interval
Arming SCPI Command Summary
Keyword/SyntaxParameter FormStd/
New
[:SENSe] (Cont.)
:TINTerval
:ARM
:ESTART
:LAYer2
:SLOPe
:SOURce
[:LAYer[1]]
:ECOunt
:SOURce
:TIMer
:ESTOP
:LAYer2
:SLOPe
:SOURce
[:LAYer[1]]
:ECOunt
POSitive | NEGative
IMMediate | EXTernal
<numeric_value>
IMMediate | TIMer |
INTernal1
<numeric_value>
POSitive | NEGative
IMMediate | EXTernal
<numeric_value>
New
New
New
New
New
New
New
New
New
New
New
New
New
New
New
New
Comments
Subtree. Controls the time interval (including
Time Interval, Rise Time, Fall Time, Dutycycle,
and Pulse Width functions) measuring
capabilities of the instrument.
Subtree. Synchronizes the time interval start and
stop arm with events.
Sets the slope of the external start arm signal
used in external arming Time Interval
measurements (including Time Interval, Rise
Time, Fall Time, Dutycycle, and Pulse Width).
Sets the start arm for time interval (including
Time Interval, Rise Time, Fall Time, Dutycycle,
and Pulse Width) measurements.
Sets the event count used to delay the start arm
for Time Interval measurements. Only applies
when [:SENS]:TINT:ARM:ESTART:SOUR INT1
is selected.
Sets the start arm delay for Time Interval
measurements.
Sets the time used to delay the start arm for
Time Interval measurements. Only applies when
[:SENS]:TINT:ARM:ESTART:SOUR TIM is
selected.
Sets the slope of the external stop arm signal
used in external arming Time Interval
measurements.
Sets the stop arm for Time Interval
measurements.
Sets the event count used to delay the stop arm
for Time Interval measurements. Only applies
when [:SENS]:TINT:ARM:ESTOP:SOUR INT2 is
selected.
2-38Programming Guide
Page 65
Chapter 2
Table 2-2A. Agilent 53132A (S/N Prefix 3646 and Above) Time Interval
Arming SCPI Command Summary (Continued)
Keyword/SyntaxParameter FormStd/
New
[:SENSe] (Cont.)
:TINTerval (Cont.)
:ARM (Cont.)
:ESTOP (Cont.)
[:LAYer[1]]
:SOURce
:TIMer
[:STARt]
:SLOPe
:SOURce
:STOP
:SOURce
:TIMer
IMMediate | TIMer |
INTernal2
<numeric_value>
POSitive | NEGative
IMMediate | EXTernal
IMMediate | TIMer
<numeric_value>
New
New
New
New
New
New
New
New
Comments
Sets the stop arm delay for Time Interval
measurements.
Sets the time used to delay the stop arm for
Time Interval measurements. Only applies
when [:SENS]:TINT:ARM:ESTOP:SOUR TIM is
selected.
Sets the slope of the external start arm signal
used in external arming Tme Interval
measurements (including Time Interval, Rise
Time, Fall Time, Dutycycle, and Pulse Width).
Only applies when
[:SENS]:TINT:ARM[:STAR]:SOUR EXT is
selected.
Sets the start arm for time interval (including
Time Interval, Rise Time, Fall Time, Dutycycle,
and Pulse Width) measurements.
Subtree.
Sets the stop arm (i.e., the delay) for Time
Interval measurements.
Sets the time used to delay the stop arm for
Time Interval measurements. Only applies
when [:SENS]:TINT:ARM:STOP:SOUR TIM is
selected.
Programming Guide2-39
Page 66
Chapter 2 Command Summary
*RST Response
*RST Response
The IEEE 488.2 *RST command returns the instrument to a specified state
optimized for remote operation. (Use *CLS to clear the status event registers and
the SCPI error queue.)
The states of commands affected by the *RST command are described in Table
2-3. Since the Agilent 53131A and Agilent 53132A have different arming
capabilities for Time Interval measurements, sub-tables (Table 2-3A and
Table 2-3B) are provided. Table 2-3A describes the state of the
Agilent 53131A’s [:SENSe]:Interval commands affected by the *RST command,
and Table 2-3B describes the Agilent 531312A’s [:SENSe]:Interval commands
affected by the *RST command. Table 2-4 lists commands that are unaffected by
*RST.
● To Measure the Statistics of 50 Measurementspg. 3-64
● To Use Limits to Filter Data Before Measuring Statspg. 3-66
● To Read and Store Calibration Datapg. 3-68
● To To Perform a Time Interval Calibrationpg. 3-69
● To Optimize Throughputpg. 3-73
● To Use Macrospg. 3-75
Where to Find QuickBASIC Programming Examples
● To Make a Frequency Measurementpg. 3-77
● To Perform Limit Testingpg. 3-78
● To Measure the Statistics of 50 Measurementspg. 3-80
● To Use Limits to Filter Data Before Measuring Statspg. 3-82
● To Read and Store Calibration Datapg. 3-85
● To Optimize Throughputpg. 3-86
● To Use Macros pg. 3-88
Where to Find Turbo C Programming Examples
● To Make a Frequency Measurementpg. 3-91
● To Use Limits to Filter Data Before Measuring Statspg. 3-93
● To Optimize Throughputpg. 3-96
Programming Guide3-3
Page 74
Chapter 3 Programming Your Universal Counter for Remote Operation
Configuring the GPIB
Configuring the GPIB
This section gives information on connecting and configuring the
GPIB to enable remote operation of the Counter.
The Counter has two GPIB operating modes:
● Addressed (talk/listen)—This mode is for bi-directional communication.
The Counter can receive commands and setups from the computer, and can
send data and measurement results.
To select the talk/listen operating mode, set the Counter’s GPIB address
from 0 to 30. Refer to the following section titled “To Set the GPIB Mode
and Address” for instructions on how to set an GPIB address from the frontpanel.
● Talk-only—In this mode, the Counter can send data to a printer. It cannot
receive commands or setups from the computer.
To select the talk-only operating mode, set the Counter’s GPIB mode to
“TALK”. Refer to the following section titled
“To Set the GPIB Mode and Address” for instructions on how to set the talkonly mode from the front-panel.
When the Counter is shipped from the factory, it is configured as addressed
(talk/listen) with the address set to “3.”
To Set the GPIB Mode and Address
1Press and hold Recall (Utility) key, then cycle POWER.
2Press Recall (Utility) key until HP-IB: is displayed.
To best demonstrate how to set the address, let’s assume that
HP-IB:3 is currently being displayed.
3-4Programming Guide
Page 75
Chapter 3
3a To set the address to “15”, perform the following:
a. Press skey.
HP-IB:03 is displayed. Note that “0” digit appears and is highlighted,
indicating that this digit will change when the
d or f arrow key is pressed.
b. Press d key.
HP-IB:13 is displayed.
c. Press g key
HP-IB:13 is displayed, but now the “3” digit is highlighted, indicating
that this digit will change when the d or f arrow key is pressed.
d. Press d key twice or until 15 is displayed.
NOTE
HP-IB:15 is displayed.
e. Go on to step 4.
3b To set the GPIB mode to “TALK,” perform the following:
a. Press skey.
HP-IB:03 is displayed. Note that “0” digit appears and is highlighted,
indicating that this digit will change when the
d or f arrow key is pressed.
b. Press d key until “TALK” is displayed.
HP-IB:TALK is displayed.
c. Go on to step 4.
4Press Enter key.
BE SURE to press the Enter key to complete the entry.
The address/mode is now stored in non-volatile memory, and does not change
when power is cycled or after a remote interface reset.
Programming Guide3-5
Page 76
Chapter 3 Programming Your Universal Counter for Remote Operation
GPIB
Configuring the GPIB
To Connect the Counter to a Computer
Connect the Counter to a computer by simply installing an GPIB cable (such as
an Agilent 10833A cable) between the two units as shown in Figure 3-1.
Figure 3-1. GPIB Interconnection
Remote/Local Operation
At power-up, the Counter is under front-panel (local) control. Once in remote,
the Counter settings cannot be affected by the front-panel controls. The Save &
Print key may be used to manually return to local control (only if local-lockout
is off).
3-6Programming Guide
Page 77
Chapter 3
Overview of Command Types and Formats
There are two types of Agilent 53131A/132A programming commands: IEEE
488.2 Common Commands and Standard Commands for Programmable
Instruments (SCPI). The IEEE 488.2 Common Commands control and manage
communications between theAgilent 53131A/132A and the controller or
personal computer. The SCPI commands control instrument functions. The
format of each type of command is described in the following paragraphs. (Refer
to
Chapter 2, “Command Summary,” for SCPI conformance information.)
Common Command Format
The IEEE 488.2 Standard defines the Common commands as commands that
perform functions like reset, self-test, status byte query, and identification.
Common commands always begin with the asterisk (*) character, and may
include parameters. The command keyword is separated from the first parameter
by a space character. Some examples of Common commands are as follows:
*RST*IDN?*RCL 1
SCPI Command and Query Format
SCPI commands perform functions like instrument setup. A subsystem command
has a hierarchical structure that usually consists of a top level (or root) keyword,
one or more lower-level keywords, and parameters. The following example
shows a command and its associated query:
:INPut:COUPling AC
:INPut:COUPling?
INPut is root-level keyword with COUPling the second level keyword, and AC is
the command parameter.
Programming Guide3-7
Page 78
Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Elements of SCPI Commands
A program command or query is composed of functional elements that include a
header (or keywords with colon separators), program data, and terminators.
These elements are sent to the Counter over the
GPIB as a sequence of ASCII data messages. Examples of a typical Common
Figure 3-2 shows the simplified syntax of a Subsystem Command. You must use
a space (SP) between the last command mnemonic and the first parameter in a
Subsystem Command. Note that if you send more than one parameter with a
single command, you must separate adjacent parameters with a comma.
NOTE: sp = space. ASCII character decimal 32
Figure 3-2. Simplified Program Command Syntax Diagram
Common Command Syntax
Figure 3-3 shows the simplified syntax of a Common Command. You must use a
space (SP) between the command mnemonic and the parameter in a Common
Command.
3-8Programming Guide
Page 79
Chapter 3
NOTE: sp = space. ASCII character decimal 32
Figure 3-3. Simplified Common Command Syntax Diagram
Abbreviated Commands
The command syntax shows most keywords as a mixture of upper and lower case
letters. Upper case letters indicate the abbreviated spelling for the command. For
better program readability, you may send the entire keyword. The Agilent
53131A/132A accepts either command form and is not case sensitive.
For example, if the command syntax shows CALCulate, then CALC and
CALCULATE are both acceptable forms. Other forms of CALCulate, such as
CALCU or CALCULA will generate an error. You may use upper and/or lower
case letters. Therefore, CALCULATE, calculate, and CaLcUlAtE are all
acceptable.
Keyword Separator
A colon (:) always separates one keyword from the next lower-level keyword as
shown below:
:INPut:COUPling?
Optional Keyword
Optional keywords are those which appear in square brackets ([ ]) in the
command syntax. (Note that the brackets are not part of the command and are
not sent to the Counter.)
Suppose you send a second level keyword without the preceding optional
keyword. In this case, the Counter assumes you intend to use the optional
keyword and responds as if you had sent it.
Programming Guide3-9
Page 80
Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Examine the portion of the [:SENSe] subsystem shown below:
[:SENSe]
:FREQuency
:ARM
:STOP
:SOURce EXTernal
The root-level keyword [:SENSe] is an optional keyword. To set the Counter’s
frequency stop arm to external, you can use either of the following:
:SENS:FREQ:ARM:STOP:SOUR EXT
or
:FREQ:ARM:STOP:SOUR EXT
Implied Channel (Optional Numeric Keyword Suffix)
Some commands allow specifying a channel with an optional numeric keyword
suffix. These commands will show the channel numbers within square brackets.
The brackets are not part of the command and are not sent to the Counter.
For example, :INPut[1|2]:COUPling AC | DC represents coupling commands for
channels 1 and 2:
:INPut[1]:COUPling AC | DC
:INPut2:COUPling AC | DC
If you do not specify the channel number, the implied channel is 1. For example,
you can send either of the following to configure
channel 1’s coupling to AC:
:INPut1:COUPling AC
or
:INPut:COUPling AC
3-10Programming Guide
Page 81
Chapter 3
Parameter Types
Table 3-1 contains explanations and examples of parameter types. Parameter types may
be numeric value, Boolean, literal, NRf, string, non-decimal numeric, or arbitrary block.
Table 3-1. Command and Query Parameter Types
TYPEEXPLANATIONS AND EXAMPLES
<numeric value>
Accepts all commonly used decimal representation of numbers including optional signs, decimal
points, and scientific notation:
123, 123e2, -123, -1.23e2, .123, 1.23e-2, 1.23000E-01.
Special cases include MINimum and MAXimum as follows:
MINimum selects minimum value available.
MAXimum selects maximum value available.
Queries using MINimum or MAXimum return the associated numeric value.
<Boolean>
<literal>
<NRf>
<string>
<non-decimal
numeric>
<arbitrary block>
Represents a single binary condition that is either true or false:
1 or ON, 0 or OFF (Query response returns only1 or 0.)
An <NRf> is rounded to an integer. A non-zero value is interpreted as 1.
Selects from a finite number of choices. These parameters use mnemonics to represent each valid
setting. An example is the INPut:COUPling AC | DC command parameters (AC | DC).
Flexible numeric representation. Only positive integers are used for NRf parameters in the Counter.
A string parameter is delimited by either single quotes or double quotes. Within the quotes, any
characters in the ASCII 7-bit code may be specified.
The following BASIC program statement sends a command containing a <string> parameter:
OUTPUT 703;"FUNC ‘FREQ’"
Format for specifying hexadecimal (#H1F), octal (#Q1077), and binary (#B10101011) numbers using
ASCII characters. May be used in :STATus subsystem commands.
The syntax is a pound sign (#) followed by a non-zero digit representing the number of digits in the
subsequent decimal integer. The decimal integer specifies the number of
8-bit data bytes being sent. This is followed by the actual data. The terminator is a line feed asserted
with EOI. For example, for transmitting 8 bytes of data, the format could be:
The “2” indicates the number of digits that follow and the two digits “08” indicate the number of data
bytes to be transmitted.
A zero-length block has the format: #0<new line>^EOI
<new line> is defined as a single ASCII-encoded byte corresponding to 10 decimal.
Programming Guide3-11
Page 82
Chapter 3 Programming Your Universal Counter for Remote Operation
Elements of SCPI Commands
Parameter Separator
If you send more than one parameter with a single command, you must separate
adjacent parameters with a comma.
Query Parameters
All selectable <numeric value> parameters can be queried to return the minimum
or maximum values they are capable of being set to by sending a MINimumor
MAXimum parameter after the “?.” For example, consider the
INPut:IMPedance? query.
If you send the query without specifying a parameter (INP:IMP?), the present
impedance value is returned. If you send the MIN parameter (using INP:IMP?
MIN), the command returns the minimum level currently available. If you send
the MAX parameter, the command returns the maximumlevel currently
available. Be sure to place a space between the question mark and the parameter.
Suffixes
A suffix is the combination of suffix elements and multipliers that can be used to
interpret the <numeric value> sent. If a suffix is not specified, the Counter
assumes that <numeric value> is unscaled (that is, Volts, seconds, etc.)
For example, the following two commands are equivalent:
Suffix elements, such as HZ (Hertz), S (seconds), V (volts),
OHM (Ohms), PCT (percent), and DEG (degrees) are allowed within this
format.
3-12Programming Guide
Page 83
Chapter 3
Suffix Multipliers
Table 3-2 lists the suffix multipliers that can be used with suffix elements
(except PCT and DEG).
Table 3-2. Suffix Multipliers
DEFINITIONMNEMONICNAME
1E18EXETA
1E15PEPETA
1E12TTERA
1E9GGIGA
1E6MA ( or M for OHM and HZ)*MEGA
1E3KKILO
1E-3M (except for OHM and HZ)*MILLI
1E-6UMICRO
1E-9NNANO
1E-12PPICO
1E-15FFEMTO
1E-18AATTO
*The suffix units, MHZ and MOHM, are special cases that should not be confused with
<suffix multiplier>HZ and <suffix multiplier>OHM.
Command Terminator
A command may be terminated with a <new line> (ASCII character decimal 10),
an EOI (End-of-Identify) asserted concurrent with last byte, or an EOI asserted
concurrent with a <new line> as the last byte.
Programming Guide3-13
Page 84
Chapter 3 Programming Your Universal Counter for Remote Operation
Using Multiple Commands
Using Multiple Commands
Program Messages
Program Messages are a combination of one or more properly formatted SCPI
Commands. Program messages always go from a computer to the Counter. They
are sent to the Counter over the Counter’s GPIB as a sequence of ASCII data
messages.
Program Message Syntax
Figure 3-4 shows the simplified syntax of a program message. You can see
Common Commands and Subsystem Commands in the same program message.
If you send more than one command in one message, you must separate adjacent
commands with a semicolon.
NOTE:
<new line> = ASCII character decimal 10
^END = EOI asserted concurrent with last byte
Figure 3-4. Simplified Program Message Syntax Diagram
When using IEEE 488.2 Common commands with SCPI Subsystem commands
on the same line, use a semicolon between adjacent commands. For example:
*RST;:INP:COUP AC
When multiple subsystem commands are sent in one program message, the first
command is always referenced to the root node. Subsequent commands,
separated by “;”, are referenced to the same level as the preceding command if
no “:” is present immediately after the command separator (the semicolon).
3-14Programming Guide
Page 85
Chapter 3
For example, sending :INP:COUP AC;IMP 50 is equivalent to sending:
:INP:COUP AC
:INP:IMP 50
or
:INP:COUP AC;:INP:IMP 50
The “:” must be present to distinguish another root level command. For example:
:INP:COUP AC;:INIT:CONT OFF
is equivalent to sending:
:INP:COUP AC
:INIT:CONT OFF
If the “:”(which is following the “;” and is in front of INIT) is omitted, the
Counter assumes that the second command is “:INP:INIT:CONT OFF” and
generates a syntax error.
Programming Guide3-15
Page 86
Chapter 3 Programming Your Universal Counter for Remote Operation
Overview of Response Message Formats
Overview of Response Message Formats
Response Messages
Response messages are data sent from the Counter to a computer in response to a
query. (A query is a command followed by a question mark. Queries are used to
find out how the Counter is currently configured and to transfer data from the
Counter to the computer.)
After receiving a query, the Counter interrogates the requested configuration and
places the response in its GPIB output queue.
The output message remains in the queue until it is read or another command is
issued. When read, the message is transmitted across the GPIB to the computer.
You read the message by using some type of enter statement that includes the
device address and an appropriate variable. Use a print statement to display the
message. The followingBASIC example illustrates how to query the Counter
and display the message:
10 OUTPUT 703;":INP:COUP?"
20 ENTER 703; A$
30 PRINT A$
40 END
Response Message Syntax
Figure 3-5 shows the simplified syntax of a Response Message. Response
messages may contain both commas and semicolon separators. When a single
query command returns multiple values, a comma is used to separate each item.
When multiple queries are sent in the same program message, the groups of data
corresponding to each query are separated by a semicolon. Note that a <new
line> ^END is always sent as a response message terminator.
NOTE:
<new line> = ASCII character decimal 10
^END = EOI asserted concurrent with last byte
; = multiple response separator (ASCII character decimal 59)
, = data separator within a response (ASCII character decimal 44)
Table 3-3 contains explanations of response data types.
Table 3-3. Response Message Data Types
TypeDescription
<NR1>This numeric representation has an implicit radix point.
maximum number of characters in <NR1> response data is 17 (maximum
16 digits, 1 sign).
<NR2>This numeric representation has an explicit radix point.
The
The maximum number of characters in <NR2> response data is 17 (maximum
15 mantissa digits, 1 sign, 1 decimal point).
<NR3>This numeric representation has an explicit radix point and an exponent.
The maximum number of characters in <NR3> response data is 22 (maximum
15 mantissa digits, 2 signs, 1 decimal point, 1 ‘E’ character, 3 exponent digits).
Not a NumberNot a Number is represented by the value 9.91E37. (Not a Number is defined in
IEEE 754). The Counter responds with this numeric value when queried for a
floating point number it cannot provide. This value will be formatted as an <NR3>.
Programming Guide3-17
Page 88
Chapter 3 Programming Your Universal Counter for Remote Operation
Overview of Response Message Formats
Table 3-3. Response Message Data Types (Continued)
TypeDescription
<Boolean>A single ASCII-encoded byte, 0 or 1, is returned for the query of settings that use
<Boolean> parameters.
<literal>ASCII-encoded bytes corresponding to the short form of the literal used as the
command parameter.
For example, if the :CALC3:AVER:TYPE MAXimum command is sent to the
Counter, the :CALC3:AVER:TYPE? response would be MAX.
<string>A string response consists of ASCII characters enclosed by double quotes.
For example, string data is used for the “<error description>” portion of
:SYST:ERR? response and for [:SENS]:FUNC? response.
<definite length
block>
The syntax is a pound sign (#) followed by a non-zero digit representing the
number of digits in the subsequent decimal integer. The decimal integer specifies
the number of 8-bitdata bytes being sent. This is followed bythe actual data. The
terminator is a line feed asserted with EOI. For example, for transmitting 8 bytes
of data, the format might be:
The “2” indicates the number of digits that follow and the two digits “08” indicate
the number of data bytes to be transmitted.
A zero-length block has the format: #0<new line>^EOI
<new line>is defined as a single ASCII-encoded byte corresponding to
10 decimal.
3-18Programming Guide
Page 89
Chapter 3
Status Reporting
The Agilent 53131A/132A status registers conform to the SCPI and IEEE 488.2
standards.
Figure 3-6 shows all the status system register groups and queues in the Counter.
This is a high level drawing that does not show all the registers that are
contained in each group. It is intended as a guide to the bits used in each of these
register groups to monitor the Counter’s status. Note that besides the Operation
Status and the Questionable Data/Signal Register groups, a summary of the
Standard Status Structure Registers (defined by IEEE 488.2-1987) is shown.
Refer to the section in this chapter titled “How to Program the Counter for Status
Reporting” and the flowchart in Figure 3-10 for detailed information on
programming the status reporting system.
Programming Guide3-19
Page 90
Chapter 3 Programming Your Universal Counter for Remote Operation
Status Reporting
Figure 3-6. Agilent 53131A/132A SCPI Status Reporting Summary
Functional Diagram
3-20Programming Guide
Page 91
Chapter 3
Status Byte Register and Service Request Enable Register
Figure 3-7. Status Byte and Service Request Enable
Status Byte Register
The Status Byte Register is the summary-level register in the status reporting
structure. It contains summary bits that monitor activity in the other status
registers and queues as shown in Figure 3-7.
The Status Byte Register is a live register—its summary bits are set TRUE or
FALSE (one or zero) by the presence or absence of the condition which is being
summarized.
The Status Byte Register can be read with either a serial poll or the *STB?
query.
The Status Byte Register is altered only when the state of the overlying status
data structures is altered.
The entire Status Byte Register can be cleared by sending the *CLS command,
by itself in a program message, to the Counter.
Table 3-4 lists the Status Byte Register bits and briefly describes each bit.
Programming Guide3-21
Page 92
Chapter 3 Programming Your Universal Counter for Remote Operation
Status Reporting
Table 3-4. Status Byte Register
BITWEIGHTSYMBOLDESCRIPTION
0Not used
1Not used
2Not used
Questionable Data/Signal Status Register
38QSB
416MAVMessage Available Summary Bit
532ESBStandard Event Status Register Summary Bit
664RQS/MSSRequest Service/Master Status Summary Bit
7128OSBOperation Status Register Summary Bit
Summary Bit
A detailed description of each bit in the Status Byte Register follows:
● Bits 0–2 are not used.
● Bit 3 (QSB) summarizes the Questionable Data/Signal Status Event
Register.
This bit indicates whether or not one or more of the enabled
Questionable Data/Signal events have occurred since the last reading or
clearing of the Questionable Data/Signal Status Event Register.
This bit is set TRUE (one) when an enabled event in the Questionable
Data/Signal Status Event Register is set TRUE. Conversely, this bit is
set FALSE (zero) when no enabled events are set TRUE.
● Bit 4 (MAV) summarizes the Output Queue.
This bit indicates whether or not the Output Queue is empty.
This bit is set TRUE (one) when the Counter is ready to accept a request
by the external computer to output data bytes; that is, the Output Queue
is not empty. This bit is set FALSE (zero) when the Output Queue is
empty.
3-22Programming Guide
Page 93
Chapter 3
● Bit 5 (ESB) summarizes the Standard Event Status Register.
This bit indicates whether or not one of the enabled Standard Event
Status Register events have occurred since the last reading or clearing of
the Standard Event Status Register.
This bit is set TRUE (one) when an enabled event in the Standard Event
Status Register is set TRUE. Conversely, this bit is set FALSE (zero)
when no enabled events are set TRUE.
● Bit 6 (RQS/MSS) summarizes IEEE 488.1 RQS and Master Summary
Status.
When a serial poll is used to read the Status Byte Register,
the RQS bit indicates if the device was sending SRQ TRUE. The RQS
bit is set FALSE by a serial poll.
When *STB? is used to read the Status Byte Register, the MSS bit
indicates the Master Summary Status. The MSS bit indicates whether or
not the Counter has at least one reason for requesting service.
● Bit 7 (OSB) summarizes the Operation Status Event Register.
This bit indicates whether or not one or more of the enabled Operation
events have occurred since the last reading or clearing of the Operation
Status Event Register.
This bit is set TRUE (one) when an enabled event in the Operation
Status Event Register is set TRUE. Conversely, this bit is set FALSE
(zero) when no enabled events are set TRUE.
Service Request Enable Register
The Service Request Enable Register selects which summary bits in the Status
Byte Register may cause service requests as shown in
Figure 3-7.
Use *SRE to write to this register and *SRE? to read this register.
Use *SRE 0 to clear the register. A cleared register does not allow status
information to generate the service requests. (Power-on also clears this register.)
Programming Guide3-23
Page 94
Chapter 3 Programming Your Universal Counter for Remote Operation
Status Reporting
Standard Event Status Register Group
Figure 3-8. Standard Event Status Reporting
Standard Event Status Register
The Standard Event Status Register contains bits that monitor specific IEEE
488.2-defined events as shown in Figure 3-8.
Use *ESR? to read this register.
Use *ESR? or *CLS to clear this register.
Table 3-5 lists the Standard Event Status Register bits and briefly describes each
bit.
Table 3-5. Standard Event Status Register
BITWEIGHTSYMBOLDESCRIPTION
01OPCOperation Complete
1(RQC)Not used because this instrument cannot
request permission to become active
IEEE 488.1 controller-in-charge.
24QYEQuery Error
38DDEDevice-Specific Error
416EXEExecution Error
532CMECommand Error
6(URQ)Not used because this instrument does not
define any local controls as “User Request”
controls.
7128PONPower On
3-24Programming Guide
Page 95
Chapter 3
A detailed description of each bit in the Standard Event Status Register follows:
● Bit 0 (Operation Complete) is an event bit which is generated in
response to the *OPC command. This bit indicates that the Counter has
completed all pending operations.
If there are no pending operations at the time *OPC executes, this bit sets
immediately.
If there is a pending operation at the time *OPC executes, this event bit
sets when the pending operation condition transistions from TRUE to
FALSE.
If
the :TRIGger:COUNt:AUTO is OFF, or
statistics are disabled, or
the function is set to Totalize or Voltage Peaks,
then the pending operation condition is set TRUE when either: 1) a single
measurement is initiated, or 2) a continuous measurement cycle is
initiated. The pending operation condition is set FALSE when the
measurement cycle terminates.
If
the TRIGger:COUNt:AUTO is ON, and
statistics are enabled, and
the function is set to Totalize or Voltage Peaks,
then the pending operation condition is set TRUE when a block of
measurements is initiated. The pending operation condition is set
FALSE when the block of measurements completes; that is, when the
last measurement in the block completes.
Bit 1 is not used.
?● Bit 2 (Query Error) is an event bit which indicates that either 1) an
attempt was made to read the Output Queue when it was empty or 2)
data in the Output Queue has been lost.
Errors -400 through -499 are query errors.
Programming Guide3-25
Page 96
Chapter 3 Programming Your Universal Counter for Remote Operation
Status Reporting
● Bit 3 (Device-Specific Error) is an event bit which indicates an operation
did not properly complete due to some condition of the Counter.
Errors -300 through -399 and all those with positive error numbers
(+2000 through ...) are device-specific errors.
● Bit 4 (Execution Error) is an event bit which indicates that a command
could not be executed 1) because the parameter was out of range or
inconsistent with the Counter’s capabilities, or 2) because of some condition
of the Counter.
Errors -200 through -299 are execution errors.
● Bit 5 (Command Error) is an event bit which indicates one of the
following has occurred: 1) an IEEE 488.2 syntax error, 2) a semantic error
indicating an unrecognized command, or 3) a Group Execute Trigger was
entered into the input buffer inside of a program message.
● Bit 6 is not used.
● Bit 7 (Power On) is an event bit which indicates that an off-to-on
transition has occurred in the Counter’s power supply.
Standard Event Status Enable Register
The Standard Event Status Enable Register selects which events in the Standard
Event Status Register are reflected in the ESB summary bit (bit 5) of the Status
Byte Register as shown in
Figure 3-8.
Use *ESE to write to this register and *ESE? to read this register.
Use *ESE 0 to clear the register. (Power-on also clears this register.)
3-26Programming Guide
Page 97
Chapter 3
Operation Status Register Group and Questionable Data/Signal
Status Register Group
The Operation Status Register Group and the Questionable Data/Signal Status
Register Group each have a complete set of registers that consists of the
following:
● a condition register
● a positive transition filter register
● a negative transition filter register
● an event register
● an event enable register
Figure 3-9 shows the model that these register groups follow.
Figure 3-9. Operation and Questionable Status Reporting Model
Programming Guide3-27
Page 98
Chapter 3 Programming Your Universal Counter for Remote Operation
Status Reporting
Condition Register
A condition register continuously monitors the hardware and firmware status of
the Counter. There is no latching or buffering for this register; it is updated in
real time. Reading a condition register does not change its contents.
A transition filter specifies the transition criteria for setting event bits TRUE.
When the transition filter specifies a positive transition, the event becomes
TRUE when its associated condition makes a FALSE to TRUE transition only.
When the transition filter specifies a negative transition, the event becomes
TRUE when its associated condition makes a TRUE to FALSE transition only.
When the transition filter specifies either a positive or a negative transition, the
event becomes TRUE when its associated condition makes either a FALSE to
TRUE or a TRUE to FALSE transition.
A transition filter is defined by a positive and negative transition filter register.
Table 3-6 describes how the transition filter registers define the transition
criteria for setting an event bit TRUE.
An event register bit (event bit) shall be set TRUE when an associated event
occurs. These bits, once set, are “sticky.” That is, they cannot be cleared even if
they do not reflect the current status of a related condition, until they are read.