This reference applies directly to software revision code A.04.00 and later.
Copyright Agilent Technologies 2001-2005
All Rights Reserved.
54830 Series Infiniium
Oscilloscopes
In This Book
This book is your guide to programming the Infiniium Series Oscilloscopes.
Chapters 1-5 give you an introduction to programming the oscilloscopes, along
with necessary conceptual information. These chapters describe basic program
communications, interface, syntax, data types, and status reporting.
Chapter 6 shows example BASIC and C programs, and describes chunks of one
program to show you some typical applications. The BASIC and C example
programs are also shipped on a disk with the oscilloscope.
Chapters 7-25 describe the commands used to program the Infiniium
Oscilloscopes. Each chapter describes the set of commands that belong to an
individual subsystem, and explains the function of each command. These
chapters include:
ACQuire
BUSMARKer
CALibrationMEASure
CHANnelPOD
CommonRoot Level
DIGital
DISKSYSTem
DISPlayTIMe Base
EXTernal ChannelTRIGger
FUNCtionWAVeform
HARDcopyWaveform MEMory
HISTogram
SELFtest
Error Messages chapter describes error messages.
ii
Contents
1 Introduction to Programming
Communicating with the Oscilloscope 1-3
Output Command 1-4
Device Address 1-4
Instructions 1-4
Instruction Header 1-4
White Space (Separator) 1-5
Braces 1-5
Ellipsis 1-5
Square Brackets 1-5
Command and Query Sources 1-5
Program Data 1-6
Header Types 1-7
Duplicate Mnemonics 1-9
Query Headers 1-10
Program Header Options 1-11
Character Program Data 1-11
Numeric Program Data 1-12
Embedded Strings 1-13
Program Message Terminator 1-13
Common Commands within a Subsystem 1-14
Selecting Multiple Subsystems 1-14
Programming Getting Started 1-14
Initialization 1-15
Example Program using HP Basic 1-16
Using the DIGITIZE Command 1-17
Receiving Information from the Oscilloscope 1-19
String Variable Example 1-20
Numeric Variable Example 1-20
Definite-Length Block Response Data 1-21
Multiple Queries 1-22
Oscilloscope Status 1-22
2 LAN and GPIB Interfaces
LAN Interface Connector2-3
GPIB Interface Connector 2-3
Default Startup Conditions 2-4
Interface Capabilities 2-5
GPIB Command and Data Concepts 2-6
Communicating Over the GPIB Interface 2-7
Communicating Over the LAN Interface 2-8
Bus Commands 2-10
Contents-1
Contents
3 Message Communication and System Functions
Protocols 3-3
4 Status Reporting
Status Reporting Data Structures 4-5
Status Byte Register 4-8
Service Request Enable Register 4-10
Message Event Register 4-10
Trigger Event Register4-10
Standard Event Status Register 4-11
Standard Event Status Enable Register 4-12
Operation Status Register 4-13
Operation Status Enable Register 4-14
Mask Test Event Register 4-15
Mask Test Event Enable Register 4-16
Trigger Armed Event Register 4-17
Acquisition Done Event Register 4-17
Error Queue 4-18
Output Queue 4-18
Message Queue 4-19
Clearing Registers and Queues 4-19
5 Programming Conventions
Truncation Rule 5-3
The Command Tree 5-4
Infinity Representation 5-14
Sequential and Overlapped Commands 5-14
Response Generation 5-14
EOI 5-14
6 Sample Programs
Sample Program Structure 6-3
Sample C Programs 6-4
Listings of the Sample Programs 6-18
gpibdecl.h Sample Header 6-19
srqagi.c Sample Program 6-21
learnstr.c Sample Program 6-23
sicl_IO.c Sample Program 6-27
natl_IO.c Sample Program 6-32
init.bas Sample Program 6-37
srq.bas Sample Program 6-45
BANDpass? 28-5
BYTeorder 28-6
COMPlete? 28-7
COUNt? 28-8
COUPling? 28-9
DATA? 28-10
DATA? Example for Analog Channels 28-12
DATA? Example for Digital Channels28-26
Error Queue 30-3
Error Numbers 30-4
Command Error 30-5
Execution Error 30-6
Device- or Oscilloscope-Specific Error 30-7
Query Error 30-8
List of Error Messages 30-9
Contents-15
Contents-16
1
Introduction to Programming
Introduction to Programming
This chapter introduces the basics for remote programming of an
oscilloscope. The programming commands in this manual conform to
the IEEE 488.2 Standard Digital Interface for Programmable
Instrumentation. The programming commands provide the means of
remote control.
Basic operations that you can do with a computer and an oscilloscope
include:
• Set up the oscilloscope.
• Make measurements.
• Get data (waveform, measurements, and configuration) from the
oscilloscope.
• Send information, such as waveforms and configurations, to the
oscilloscope.
You can accomplish other tasks by combining these functions.
Example Programs are Written in HP BASIC and C
The programming examples for individual commands in this manual are written in
HP BASIC and C.
1-2
Introduction to Programming
Communicating with the Oscilloscope
Communicating with the Oscilloscope
Computers communicate with the oscilloscope by sending and receiving
messages over a remote interface, such as a GPIB card or a Local Area Network
(LAN) card. Commands for programming normally appear as ASCII character
strings embedded inside the output statements of a “host” language available
on your computer. The input commands of the host language are used to read
responses from the oscilloscope.
For example, HP BASIC uses the OUTPUT statement for sending commands
and queries. After a query is sent, the response is usually read using the
HP BASIC ENTER statement. The ENTER statement passes the value across
the bus to the computer and places it in the designated variable.
For the GPIB interface, messages are placed on the bus using an output
command and passing the device address, program message, and a terminator.
Passing the device address ensures that the program message is sent to the
correct GPIB interface and GPIB device.
The following HP BASIC OUTPUT statement sends a command that sets the
channel 1 scale value to 500 mV:
The device address represents the address of the device being programmed.
Each of the other parts of the above statement are explained on the following
pages.
Use the Suffix Multiplier Instead
Using "mV" or "V" following the numeric voltage value in some commands will cause
Error 138 - Suffix not allowed. Instead, use the convention for the suffix multiplier as
described in chapter 3, "Message Communication and System Functions."
1-3
Introduction to Programming
Output Command
Output Command
The output command depends entirely on the programming language.
Throughout this book, HP BASIC and ANSI C are used in the examples of
individual commands. If you are using other languages, you will need to find
the equivalents of HP BASIC commands like OUTPUT, ENTER, and CLEAR, to
convert the examples.
Device Address
The location where the device address must be specified depends on the
programming language you are using. In some languages, it may be specified
outside the OUTPUT command. In HP BASIC, it is always specified after the
keyword, OUTPUT. The examples in this manual assume that the oscilloscope
and interface card are at GPIB device address 707. When writing programs, the
device address varies according to how the bus is configured.
Instructions
Instructions, both commands and queries, normally appear as strings embedded
in a statement of your host language, such as BASIC, Pascal, or C. The only
time a parameter is not meant to be expressed as a string is when the
instruction's syntax definition specifies <block data>, such as HP BASIC’s
"learnstring" command. There are only a few instructions that use block data.
Instructions are composed of two main parts:
• The header, which specifies the command or query to be sent.
• The program data, which provides additional information to clarify the
meaning of the instruction.
Instruction Header
The instruction header is one or more command mnemonics separated by
colons (:). They represent the operation to be performed by the oscilloscope.
See the “Programming Conventions” chapter for more information.
Queries are formed by adding a question mark (?) to the end of the header.
Many instructions can be used as either commands or queries, depending on
whether or not you include the question mark. The command and query forms
of an instruction usually have different program data. Many queries do not use
any program data.
1-4
Introduction to Programming
White Space (Separator)
White Space (Separator)
White space is used to separate the instruction header from the program data.
If the instruction does not require any program data parameters, you do not
need to include any white space. In this manual, white space is defined as one
or more spaces. ASCII defines a space to be character 32 in decimal.
Braces
When several items are enclosed by braces, { }, only one of these elements may
be selected. Vertical line ( | ) indicates "or". For example, {ON | OFF} indicates
that only ON or OFF may be selected, not both.
Ellipsis
... An ellipsis (trailing dots) indicates that the preceding element may be
repeated one or more times.
Square Brackets
Items enclosed in square brackets, [ ], are optional.
Command and Query Sources
Many commands and queries require that a source be specified. Depending on
the command or query and the model number of Infiniium oscilloscope being
used, some of the sources are not available. The following is a list of sources:
CHANnel1FUNCtion1WMEMory1
CHANnel2FUNCtion2WMEMory2
CHANnel3FUNCtion3WMEMory3
CHANnel4FUNCtion4WMEMory4
DIGital0DIGital1DIGital2DIGital3
DIGital4DIGital5DIGital6DIGital7
DIGital8DIGital9DIGital10DIGital11
DIGital12DIGital13DIGital14DIGital15
CLOCkMTRendMSPectrumHISTogram
1-5
Introduction to Programming
Program Data
Program Data
Program data is used to clarify the meaning of the command or query. It
provides necessary information, such as whether a function should be on or off,
or which waveform is to be displayed. Each instruction’s syntax definition
shows the program data and the values they accept.
When there is more than one data parameter, they are separated by commas (,).
You can add spaces around the commas to improve readability.
1-6
Introduction to Programming
Header Types
Header Types
There are three types of headers:
• Simple Command headers
• Compound Command headers
• Common Command headers
Simple Command Header
Simple command headers contain a single mnemonic. AUTOSCALE and
DIGITIZE are examples of simple command headers typically used in this
oscilloscope. The syntax is:
<program mnemonic><terminator>
or
OUTPUT 707;”:AUTOSCALE”
When program data must be included with the simple command header
(for example, :DIGITIZE CHAN1), white space is added to separate the data
from the header. The syntax is:
Compound command headers are a combination of two program mnemonics.
The first mnemonic selects the subsystem, and the second mnemonic selects
the function within that subsystem. The mnemonics within the compound
message are separated by colons. For example:
Common command headers, such as clear status, control the IEEE 488.2
functions within the oscilloscope. The syntax is:
*<command header><terminator>
No space or separator is allowed between the asterisk (*) and the command
header. *CLS is an example of a common command header.
1-8
Introduction to Programming
Duplicate Mnemonics
Duplicate Mnemonics
Identical function mnemonics can be used for more than one subsystem. For
example, you can use the function mnemonic RANGE to change both the
vertical range and horizontal range:
To set the vertical range of channel 1 to 0.4 volts full scale:
:CHANNEL1:RANGE .4
To set the horizontal time base to 1 second full scale:
:TIMEBASE:RANGE 1
In these examples, CHANNEL1 and TIMEBASE are subsystem selectors, and
determine the range type being modified.
1-9
Introduction to Programming
Query Headers
Query Headers
A command header immediately followed by a question mark (?) is a query.
After receiving a query, the oscilloscope interrogates the requested subsystem
and places the answer in its output queue. The answer remains in the output
queue until it is read or until another command is issued. When read, the answer
is transmitted across the bus to the designated listener (typically a computer).
For example, the query:
:TIMEBASE:RANGE?
places the current time base setting in the output queue.
In HP BASIC, the computer input statement:
ENTER < device address > ;Range
passes the value across the bus to the computer and places it in the variable
Range.
You can use queries to find out how the oscilloscope is currently configured and
to get results of measurements made by the oscilloscope.
For example, the command:
:MEASURE:RISETIME?
tells the oscilloscope to measure the rise time of your waveform and place the
result in the output queue.
The output queue must be read before the next program message is sent. For
example, when you send the query :MEASURE:RISETIME?, you must follow it
with an input statement. In HP BASIC, this is usually done with an ENTER
statement immediately followed by a variable name. This statement reads the
result of the query and places the result in a specified variable.
Handle Queries Properly
If you send another command or query before reading the result of a query, the output
buffer is cleared and the current response is lost. This also generates a queryinterrupted error in the error queue. If you execute an input statement before you
send a query, it will cause the computer to wait indefinitely.
1-10
Introduction to Programming
Program Header Options
Program Header Options
You can send program headers using any combination of uppercase or lowercase
ASCII characters. Oscilloscope responses, however, are always returned in
uppercase.
You may send program command and query headers in either long form
(complete spelling), short form (abbreviated spelling), or any combination of
long form and short form. For example:
:TIMEBASE:DELAY 1E-6 is the long form.
:TIM:DEL 1E-6 is the short form.
Using Long Form or Short Form
Programs written in long form are easily read and are almost self-documenting.
The short form syntax conserves the amount of computer memory needed for
program storage and reduces I/O activity.
The rules for the short form syntax are described in the chapter, “Programming
Conventions.”
Character Program Data
Character program data is used to convey parameter information as alpha or
alphanumeric strings. For example, the :TIMEBASE:REFERENCE command
can be set to left, center, or right. The character program data in this case may
be LEFT, CENTER, or RIGHT. The command :TIMEBASE:REFERENCE
RIGHT sets the time base reference to right.
The available mnemonics for character program data are always included with
the instruction's syntax definition. You may send either the long form of
commands, or the short form (if one exists). You may mix uppercase and
lowercase letters freely. When receiving responses, uppercase letters are used
exclusively.
1-11
Introduction to Programming
Numeric Program Data
Numeric Program Data
Some command headers require program data to be expressed numerically. For
example, :TIMEBASE:RANGE requires the desired full-scale range to be
expressed numerically.
For numeric program data, you can use exponential notation or suffix
multipliers to indicate the numeric value. The following numbers are all equal:
28 = 0.28E2 = 280E-1 = 28000m = 0.028K = 28E-3K
When a syntax definition specifies that a number is an integer, it means that the
number should be whole. Any fractional part is ignored and truncated. Numeric
data parameters that accept fractional values are called real numbers. For more
information see the chapter, “Interface Functions.”
All numbers are expected to be strings of ASCII characters.
• When sending the number 9, you would send a byte representing the
ASCII code for the character “9” (which is 57).
• A three-digit number like 102 would take up three bytes (ASCII codes 49,
48, and 50). The number of bytes is figured automatically when you
include the entire instruction in a string.
1-12
Loading...
+ 844 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.