This book is your guide to programming the Infiniium 80000B Series
Oscilloscopes.
Chapters 1 through 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 through 25 describe the commands used to program the
oscilloscopes. Each chapter describes the set of commands that belong to an
individual subsystem, and explains the function of each command. These
chapters include:
ACQuireMask TESt
CALibrationMEASure
CHANnelRoot Level
CommonSELFtest
DISKSYSTem
DISPlayTIMe Base
FUNCtionTRIGger
HARDcopyWAVeform
HISTogramWaveform MEMory
MARKer
Chapter 30 describes error messages.
ii
Contents
1 Introduction to Programming
Communicating with the Oscilloscope1-3
Output Command1-4
Device Address1-4
Instructions1-4
Instruction Header1-4
White Space (Separator)1-5
Braces1-5
Ellipsis1-5
Square Brackets1-5
Command and Query Sources1-5
Program Data1-6
Header Types1-7
Duplicate Mnemonics1-9
Query Headers1-10
Program Header Options1-11
Character Program Data1-11
Numeric Program Data1-12
Embedded Strings1-13
Program Message Terminator1-13
Common Commands within a Subsystem1-14
Selecting Multiple Subsystems1-14
Programming Getting Started1-14
Initialization1-15
Example Program using HP Basic1-16
Using the DIGITIZE Command1-17
Receiving Information from the Oscilloscope1-19
String Variable Example1-20
Numeric Variable Example1-20
Definite-Length Block Response Data1-21
Multiple Queries1-22
Oscilloscope Status1-22
2 LAN and GPIB Interfaces
LAN Interface Connector2-3
GPIB Interface Connector2-3
Default Startup Conditions2-4
Interface Capabilities2-5
GPIB Command and Data Concepts2-6
Communicating Over the GPIB Interface2-7
Communicating Over the LAN Interface2-8
Communicating via Telnet and Sockets2-10
Bus Commands2-12
3 Message Communication and System Functions
Contents-1
Contents
Protocols3-3
4 Status Reporting
Status Reporting Data Structures4-5
Status Byte Register4-8
Service Request Enable Register4-10
Message Event Register4-10
Trigger Event Register4-10
Standard Event Status Register4-11
Standard Event Status Enable Register4-12
Operation Status Register4-13
Operation Status Enable Register4-14
Mask Test Event Register4-15
Mask Test Event Enable Register4-16
Trigger Armed Event Register4-17
Acquisition Done Event Register4-17
Error Queue4-18
Output Queue4-18
Message Queue4-19
Clearing Registers and Queues4-19
5 Remote Acquisition Synchronization
Introduction5-2
Programming Flow5-2
Setting Up the Oscilloscope5-2
Acquiring a Waveform5-3
Retrieving Results5-3
Acquisition Synchronization5-4
Single Shot Device Under Test (DUT)5-5
Averaging Acquisition Synchronization5-7
6 Programming Conventions
Truncation Rule6-3
The Command Tree6-4
Infinity Representation6-12
Sequential and Overlapped Commands6-12
Response Generation6-12
EOI6-12
7 Sample Programs
Sample Program Structure7-3
Sample C Programs7-4
Listings of the Sample Programs7-18
gpibdecl.h Sample Header7-19
srqagi.c Sample Program7-21
learnstr.c Sample Program7-23
Error Queue 30-3
Error Numbers30-4
Command Error30-5
Execution Error30-6
Device- or Oscilloscope-Specific Error30-7
Query Error30-8
List of Error Messages30-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
query-interrupted 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
Loading...
+ 890 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.