HP 53150A Series Operating instructions

Programming
Guide
HP 53150A/151A/152A
Microwave Frequency Counter


HP 53150A/151A/152A Microwave
Frequency Counter
Programming Guide
This guide describes how to program the HP 53150A, 53151A, and 53152A
Microwave Frequency Counters. The information in this guide applies to
instruments having the number prefix listed below, unless accompanied
by a “Manual Updating Changes” package indicating otherwise.
SERIAL PREFIX NUMBER: 3735A and above (53150A)
3736A and above (53151A)
3737A and above (53152A)

Hewlett-Packard Company 8.NC.NL.A.11.03.97.R1.P.CW1C3NC
Santa Clara Division
5301 Stevens Creek Boulevard
Santa Clara, California 95052-8059
Copyright Hewlett-Packard
Company 1996
All Rights Reserved.
Reproduction, adaptation, or
translations without prior
written permission is
prohibited, except as allowed
under the copyright laws.
Printed: November 1997
Printed in USA
Manual part number
53150-90002
Certification
and Warrant
y
Certification
Hewlett-Packard Company
certifies that this product met
its published specification at the
time of shipment from the
factory. Hewlett-Packard
further certifies that its
calibration measurements are
traceable to the United States
National Institute of Standards
and Technology (formerly
National Bureau of Standards),
to the extent allowed by the
Institute’s calibration facility,
and to the calibration facilities
of other International
Standards Organization
members.
Warrant
y
HP warrants HP hardware,
accessories and supplies against
defects in materials and
workmanship for a period of one
year from date of shipment. If
HP receives notice of such
defects during the warranty
period, HP will, at its option,
either repair or replace products
which prove to be defective.
Replacement products may be
either new or like-new.
HP warrants that HP software
will not fail to execute its
programming instructions, for
the period specified above, due
to defects in material and
workmanship when properly
installed and used. If HP
receives notice of such defects
during the warranty period, HP
will replace software media
which does not execute its
programming instructions due
to such defects.
For detailed warranty
information, see back matter.
Safet
y
Considerations
General
This product and related
documentation must be
reviewed for familiarization
with this safety markings and
instructions before operation.
Before Cleaning
Disconnect the product from
operating power before
cleaning.
Warning S
y
mbols That Ma
y
Be Used In This Book
Instruction manual symbol; the
product will be marked with
this symbol when it is necessary
for the user to refer to the
instruction manual.
Indicates hazardous voltages.
Indicates earth (ground)
terminal.
or
Indicates terminal is connected
to chassis when such connection
is not apparent.
Indicates Alternating current.
Indicates Direct current.
Safet
y
Considerations
(contd)
WARNING
BODILY INJURY OR DEATH
MAY RESULT FROM
FAILURE TO HEED A
WARNING. DO NOT
PROCEED BEYOND A
WARNING UNTIL THE
INDICATED CONDITIONS
ARE FULLY UNDERSTOOD
AND MET.
CAUTION
Damage to equipment, or
incorrect measurement data,
may result from failure to
heed a caution. Do not
proceed beyond a CAUTION
until the indicated conditions
are fully understood and met.
Safet
y
Earth Ground
An uninterruptible safety earth
ground must be maintained
from the mains power source to
the product’s ground circuitry.
WARNING
WHEN MEASURING POWER
LINE SIGNALS, BE
EXTREMELY CAREFUL AND
ALWAYS USE A
STEP-DOWN ISOLATION
TRANSFORMER WHICH
OUTPUT IS COMPATIBLE
WITH THE INPUT
MEASUREMENT
CAPABILITIES OF THIS
PRODUCT. THIS PRODUCT’S
FRONT AND REAR PANELS
ARE TYPCIALLY AT EARTH
GROUND.
THUS,NEVER TRY
TO MEASURE AC POWER
LINE SIGNALS WITHOUT AN
ISOLATION TRANSFORMER.
For additional safety and
acoustic noise information, see
back matter.

Contents
Programming Guide v
1 Before You Start ...
Introduction 1-2
Getting Started 1-3
How to Use This Guide 1-3
New Users 1-4
Experienced Programmers 1-5
Applications 1-5
Programming Guide Contents 1-6
Assumptions 1-7
Related Documentation 1-8
2 Command Summar
y
Introduction 2-2
Chapter Summary 2-2
Front Panel to SCPI Command Map 2-3
HP 53150A/151A/152A Command Summary 2-8
SCPI Conformance Information 2-8
IEEE 488.2 Common Commands 2-9
HP 53150A/151A/152A SCPI Subsystem Commands 2-12
Std/New Column 2-12
Parameter Form Column 2-12
*RST Response 2-19
3 Programming Your Counter
for Remote Operation
Introduction 3-2
Chapter Summary 3-3
Where to Find Some Specific Information 3-4
Programming Examples 3-4

Contents
vi Programming Guide
Connecting the Counter to a Computer 3-5
To Connect With the HP-IB 3-5
IEEE 488.1 Interface Capabilities 3-6
To Connect With the RS-232 Serial Interface 3-7
Remote/Local Operation 3-11
Overview of Command Types and Formats 3-12
Common Command Format 3-12
SCPI Command and Query Format 3-12
Elements of SCPI Commands 3-13
Subsystem Command Syntax 3-13
Common Command Syntax 3-13
Abbreviated Commands 3-14
Keyword Separator 3-14
Optional Keyword 3-14
Parameter Types 3-16
Parameter Separator 3-17
Query Parameters 3-17
Suffixes 3-17
Command Terminator 3-18
Using Multiple Commands 3-19
Program Messages 3-19
Program Message Syntax 3-19
Overview of Response Message Formats 3-21
Response Messages 3-21
Response Message Syntax 3-21
Response Message Data Types 3-23
Status Reporting 3-25
Status Byte Register and
Service Request Enable Register 3-27
Standard Event Status Register Group 3-30
The Operation and Questionable Data Status Register
Groups 3-33

Contents
Programming Guide vii
Programming the Counter
for Status Reporting 3-41
Determining the Condition of the Counter 3-41
Resetting the Counter and Clearing
the Remote Interface—Example 1 3-42
Using the Standard Event Status Register to
Trap an Incorrect Command—Example 2 3-42
Using the Operation Status Register to Alert the Computer
When Measuring has
Completed—Example 3 3-43
Programming the Counter
to Display Results 3-46
Configuring the Counter's Display 3-46
Commands for Displaying Results 3-47
Command for Displaying Raw Results 3-47
Commands for Displaying Relative Results 3-47
Commands for Enabling and Disabling the Display 3-47
Programming the Counter to
Synchronize Measurements 3-48
Synchronizing Measurement Completion 3-48
Resetting the Counter and Clearing the Interface 3-48
Using the *WAI Command 3-49
Using the *OPC? Command 3-49
Using the *OPC Command to Assert SRQ 3-50
Writing SCPI Programs 3-52

Contents
viii Programming Guide
Programming Examples 3-54
Using HP BASIC 3-54
Using C 3-55
List of the Programming Examples 3-55
Making a Frequency Measurement (HP BASIC) 3-56
Making a Frequency Measurement (QuickBASIC) 3-57
Making a Frequency Measurement (C) 3-58
4 Command Reference
Introduction 4-2
:ABORt Command 4-4
:DISPlay Subsystem 4-5
Group Execute Trigger
(GET) 4-7
:INITiate Subsystem 4-8
:INPut Subsystem 4-9
:MEASure Subsystem 4-10
Measurement Instructions
(:CONFigure, :FETCh, :MEASure, :READ) 4-10
Descriptions of the Measurement Functions 4-16
How to Use the Measurement Instruction Commands 4-
17
:MEMory Subsystem 4-20
[:SENSe] Subsystem 4-22
[:SENSe]:FUNCtion Subtree 4-27
[:SENSe]:POWer Subtree 4-29
[:SENSe]:ROSCillator Subtree 4-30
:STATus Subsystem 4-31
:STATus:OPERation Subtree 4-31
:STATus:QUEStionable Subtree 4-36
:SYSTem Subsystem 4-39
:SYSTem:COMMunicate Subtree 4-39

Contents
Programming Guide ix
:TRIGger Subsystem 4-43
Common Commands 4-44
*CLS (Clear Status Command) 4-45
*DDT (Define Device Trigger Command)
*DDT? (Define Device Trigger Query) 4-46
*ESE (Standard Event Status Enable Command)
*ESE? (Standard Event Status Enable Query) 4-47
*ESR? (Event Status Register Query) 4-49
*IDN? (Identification Query) 4-50
*IST? (Instrument Status) 4-50
*OPC (Operation Complete Command) 4-51
*OPC? (Operation Complete Query) 4-51
*PRE (Parallel Poll Enable Register)
*PRE? (Parallel Poll Enable Register Query) 4-52
*RCL (Recall Command) 4-52
*RST (Reset Command) 4-53
*SAV (Save Command) 4-54
*SRE (Service Request Enable Command)
*SRE? (Service Request Enable Query) 4-55
*TRG (Trigger Command) 4-58
*TST? (Self-Test Query) 4-59
*WAI (Wait-to-Continue Command) 4-61
5Errors
Introduction 5-2
Reading an Error 5-3
Error Queue 5-4
Error Types 5-5
No Error 5-5
Command Error 5-6
Execution Error 5-6
Device- or Counter-Specific Error 5-7
Query Error 5-7
Error List 5-7

Contents
x Programming Guide

1
Before You Start ...

Chapter 1 Before You Start ...
Introduction
1-2 Programming Guide
1
Introduction
This programming guide contains programming information for the
HP 53150A, 53151A, and 53152A Microwave Frequency Counters.
This guide assumes you are familiar with the front-panel operation of the
Counter. See the HP 53150A/151A/152A 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 want to perform makes the programming task much
easier. The operating guide provides explanations and 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, you can remotely operate many of the Counter's front-panel
functions via the Hewlett-Packard Interface Bus (HP-IB) or the RS-232
serial interface. These programming commands conform to the Standard
Commands for Programmable Instruments (SCPI) Standard Version
1992.0. The SCPI standard does not completely redefine how to program
instruments over the Hewlett-Packard Interface Bus (HP-IB) or the
RS-232 serial interface. However, it does standardize the structure and
content of an instrument's command set to reflect the best programming
practices developed by people using HP-IB. 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 HP instruments that have been released
over the last few years, you have probably 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.

Chapter 1 Before You Start ...
Getting Started
Programming Guide 1-3
1
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.
NOTE
With two minor exceptions, the only difference between programming the
Counter using the HP-IB interface and the RS-232 serial interface is the
manner in which you connect the Counter to the computer. These
exceptions are:
1. The Counter sends a command prompt over the RS-232 interface (but
not the HP-IB) after receiving and executing each command.
2. When an error is detected (during the Self-Test or during operation),
the Counter automatically sends an error message (or messages) over
the RS-232 interface (error messages must be requested over the
HP-IB). For additional information on error messages, see Appendix B
of the HP 3150A/151A/152A Operating Guide.

Chapter 1 Before You Start ...
How to Use This Guide
1-4 Programming Guide
1
New Users
What You Should Understand
As a new user, you must have some understanding of a high-level
language, such as BASIC or C, before you can use the command set
defined in this guide to control the Counter. (In Chapter 3, “Programming
Your Counter for Remote Operation,” there are programming examples
provided in HP BASIC, MicrosoftQuickBASIC, and BorlandTurbo C.)
However, whatever language you use, the command strings that control
the Counter remain the same.
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 Map” in Chapter 2.
• Read Chapter 3, “Programming Your Counter for Remote
Operation,” for an overview of SCPI concepts as they relate to the
HP 53150A, 53151A, and 53152A Frequency Counters. 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.”
• 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.

Chapter 1 Before You Start ...
How to Use This Guide
Programming Guide 1-5
1
Experienced Programmers
If you have programmed other HP-IB instruments, you are probably
familiar with many of the concepts and techniques discussed in this guide.
Using the SCPI commands is also very similar to using the earlier HP-IB
commands. The main difference between the two command sets is the
hierarchy of the subsystem commands. (However, this type of structure
has previously been used on other instruments.)
Because the SCPI command set and some of the status reporting
techniques are new, we advise you 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
provided in Chapter 3, “Programming Your 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 test 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.
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 section titled
“Overview of Response Message Formats” in Chapter 3.

Chapter 1 Before You Start ...
Programming Guide Contents
1-6 Programming Guide
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 Counter for Remote Operation,”
describes how to connect and 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 want the Counter to perform.
• Chapter 4, “Command Reference,” is a command dictionary that
describes the SCPI subsystems and IEEE 488.2 Common
commands.
• Chapter 5, “Errors,” lists all of the error messages the Counter
generates and the cause(s) for each error.
•Index

Chapter 1 Before You Start ...
Assumptions
Programming Guide 1-7
1
Assumptions
This guide assumes the Counter is correctly installed and interfaced to an
external computer. If it is not, and you intend to use the HP-IB, see the
IEEE HP-IB Interconnection information in Hewlett-Packard Company,
Tutorial Description of the Hewlett-Packard Interface Bus, 1987. (See the
section in this chapter titled “Related Documentation” for ordering
information.) If you intend to use the RS-232 serial interface, see the
section in Chapter 3 titled “To Connect With the RS-232 Serial Interface.”
As previously mentioned, this guide also assumes you are familiar with
the front-panel operation of the Counter. See the HP 53150A/151A/152A
Operating Guide for detailed information about front-panel operation.
Knowing how to control the Counter from the front panel and
understanding the measurements you need to perform makes the
programming task much easier.

Chapter 1 Before You Start ...
Related Documentation
1-8 Programming Guide
1
Related Documentation
This section contains a list of documentation that relates to the use of the
Counter. Additional information that may be useful is contained in the
following publications:
1. HP 53150A/151A/152A Microwave Frequency Counter Operating
Guide (HP Part Number 53150-90001)
2. Beginner's Guide to SCPI (HP 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), (latest
version).
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.

Chapter 1 Before You Start ...
Related Documentation
Programming Guide 1-9
1
This standard defines the technical details required to design and
build an HP-IB (IEEE 488.1) interface. This standard contains
electrical specifications and information on protocol that is beyond the
needs of most programmers. However, it can be useful to clarify
formal definitions of certain terms used in related documents.
To obtain a copy of this standard, write to:
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.1-1987 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 types,
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
7. Hewlett-Packard Company, BASIC 5.0/5.1 Interfacing Techniques
Vol 2., Specific Interfaces, 1987.
This HP BASIC manual contains a good non-technical description of
the HP-IB (IEEE 488.1) interface in Chapter 12, “The HP-IB
Interface.” Subsequent revisions of HP BASIC may use a slightly
different title for this manual or chapter. This manual is the best
reference on I/O for HP BASIC programmers.
To obtain a copy of this manual, contact your nearest Hewlett-Packard
Sales office.
8. Hewlett-Packard Company, Tutorial Description of the Hewlett-
Packard Interface Bus, 1987.
To obtain a copy of this manual, contact your nearest Hewlett-Packard
Sales office.

Chapter 1 Before You Start ...
Related Documentation
1-10 Programming Guide
1
This manual suits for next models
2
Table of contents
Other HP Cash Counter manuals