Text preview for : Agilent-54621a-programmers-guide.pdf part of Agilent-HP-Keysight 54621A/22A/24A-54621D/22D Programmer’s Guide 54621A/22A/24A Oscilloscopes and 54621D/22D Mixed-Signal Oscilloscopes



Back to : Agilent-54621a-programmer | Home

Programmer's Guide

Publication Number 54622-97027 November 2001

For Safety information, Warranties, and Regulatory information, see the pages behind the Index.

©

Copyright Agilent Technologies 2000-2001 All Rights Reserved

54621A/22A/24A Oscilloscopes and 54621D/22D Mixed-Signal Oscilloscopes

Programming the Oscilloscope
When you attach an interface module to the rear of the oscilloscope, it becomes programmable. That is, you can hook a controller (such as a PC or workstation) to it, and write programs on that controller to automate oscilloscope setup and data capture. The following figure shows the basic structure of every program you will write for the oscilloscope.

Initialize
To ensure consistent, repeatable performance, you need to start the program, controller, and oscilloscope in a known state. Without correct initialization, your program may run correctly in one instance and not in another. This might be due to changes made in configuration by previous program runs or from the front panel of the oscilloscope. · Program initialization defines and initializes variables, allocates memory, or tests system configuration. · Controller initialization ensures that the interface to the oscilloscope (either GPIB or RS-232) is properly set up and ready for data transfer. · Oscilloscope initialization sets the channel configuration and labels, threshold voltages, trigger specification and mode, timebase, and acquisition type.

ii

Capture
Once you initialize the oscilloscope, you can begin capturing data for analysis. Remember that while the oscilloscope is responding to commands from the controller, it is not performing acquisitions. Also, when you change the oscilloscope configuration, any data already captured will most likely be rendered. To collect data, you use the :DIGitize command. This command clears the waveform buffers and starts the acquisition process. Acquisition continues until acquisition memory is full, then stops. The acquired data is displayed by the oscilloscope, and the captured data can be measured, stored in trace memory in the oscilloscope, or transferred to the controller for further analysis. Any additional commands sent while :DIGitize is working are buffered until :DIGitize is complete. You could also put the oscilloscope into run mode, then use a wait loop in your program to ensure that the oscilloscope has completed at least one acquisition before you make a measurement. HP does not recommend this because the needed length of the wait loop may vary, causing your program to fail. :DIGitize, on the other hand, ensures that data capture is complete. Also, :DIGitize, when complete, stops the acquisition process so that all measurements are on displayed data, not on a constantly changing data set.

Analyze
After the oscilloscope has completed an acquisition, you can find out more about the data, either by using the oscilloscope measurements or by transferring the data to the controller for manipulation by your program. Built-in measurements include frequency, duty cycle, period, and positive and negative pulse width. Using the :WAVeform commands, you can transfer the data to your controller. You may want to display the data, compare it to a known good measurement, or simply check logic patterns at various time intervals in the acquisition.

iii

In This Book

This Programmer's Guide is your introduction to programming the oscilloscope using an instrument controller. This book, with the Programmer's Reference, provides a comprehensive description of the oscilloscope's programmatic interface. The Programmer's Reference is supplied as a Microsoft Windows Help file on a 3.5" diskette. The oscilloscope has a built-in RS-232-C port for programming. To program the oscilloscope over GPIB, you need the N2757A GPIB Interface Module. You also need an instrument controller that supports either the IEEE-488 or RS-232-C interface standards, and a programming language capable of communicating with these interfaces. This book contains the following information: Chapter 1 Introduction to Programming, gives a general overview of oscilloscope programming. Chapter 2 Programming Getting Started, shows a simple program, explains its operation, and discusses considerations for data types. Chapter 3 GPIB, discusses the general considerations for programming the instrument over an GPIB interface. Chapter 4 Programming over RS-232-C, discusses the general considerations for programming the instrument over an RS-232-C interface. Chapter 5 Programming and Documentation Conventions, describes the conventions used in representing the syntax of commands throughout this book and the Programmer's Reference, and gives an overview of the oscilloscope command set. Chapter 6 Status Reporting, discusses the oscilloscope status registers and how to use them in your programs. Chapter 7 Installing and Using the Programmer's Reference, tells how to install the Programmer's Reference online help file in Microsoft Windows, and explains help file navigation. Chapter 8 Programmer's Quick Reference, lists all the commands and queries available for programming the oscilloscope. For information on oscilloscope operation, see the User's Guide. For information on interface configuration, see the documentation for the oscilloscope interface module and the interface card used in your controller (for example, the HP82350A interface for IBM PC-compatible computers).

iv

Contents

1 Introduction to Programming
Talking to the Instrument 1-3 Program Message Syntax 1-4 Combining Commands from the Same Subsystem 1-7 Duplicate Mnemonics 1-8 Query Command 1-9 Program Header Options 1-10 Program Data Syntax Rules 1-11 Program Message Terminator 1-13 Selecting Multiple Subsystems 1-14

2 Programming Getting Started
Initialization 2-3 Autoscale 2-4 Setting Up the Instrument 2-5 Example Program 2-6 Using the DIGitize Command 2-7 Receiving Information from the Instrument 2-9 String Variables 2-10 Numeric Variables 2-11 Definite-Length Block Response Data 2-12 Multiple Queries 2-13 Instrument Status 2-13

3 Programming over GPIB
Interface Capabilities 3-3 Command and Data Concepts 3-3 Addressing 3-4 Communicating Over the Bus 3-5 Lockout 3-6 Bus Commands 3-6

4 Programming over RS-232-C
Interface Operation 4-3 Cables 4-3 Minimum Three-Wire Interface with Software Protocol 4-4 Extended Interface with Hardware Handshake 4-5 Configuring the Interface 4-6 Interface Capabilities 4-7 Lockout Command 4-8

Contents-1

Contents

5 Programming and Documentation Conventions
Command Set Organization 5-3 The Command Tree 5-6 Obsolete and Discontinued Commands 5-10 Truncation Rules 5-15 Infinity Representation 5-16 Sequential and Overlapped Commands 5-16 Response Generation 5-16 Notation Conventions and Definitions 5-17 Program Examples 5-18

6 Status Reporting
Status Reporting Data Structures 6-5 Status Byte Register (SBR) 6-8 Service Request Enable Register (SRER) 6-10 Trigger Event Register (TRG) 6-10 Standard Event Status Register (SESR) 6-11 Standard Event Status Enable Register (SESER) 6-12 User Event Register (UER) 6-13 Local Event Register (LCL) 6-13 Operation Status Register (OPR) 6-13 Limit Test Event Register (LTER) 6-14 Mask Test Event Register (MTER) 6-15 Histogram Event Register (HER) 6-16 Arm Event Register (ARM) 6-16 Error Queue 6-17 Output Queue 6-18 Message Queue 6-18 Key Queue 6-18 Clearing Registers and Queues 6-18

7 Installing and Using the Programmer's Reference
To install the help file under Microsoft Windows 7-3 To get updated help and program files via the Internet 7-4 To start the help file 7-5 To navigate through the help file 7-5

8 Programmer's Quick Reference
Conventions 8-3 Suffix Multipliers 8-3 Commands and Queries 8-4

Contents-2

1

Introduction to Programming

Introduction to Programming

Chapters 1 and 2 introduce the basics for remote programming of an oscilloscope. The programming instructions in this manual conform to the IEEE488.2 Standard Digital Interface for Programmable Instrumentation. The programming instructions provide the means of remote control. To program the oscilloscope you must add either a GPIB (N2757A) interface, or program over the built-in RS-232-C interface on the rear panel. You can perform the following basic operations with a controller and an oscilloscope: · Set up the instrument. · Make measurements. · Acquire data (waveform, measurements, configuration) from the oscilloscope. · Send information (pixel images, configurations) to the oscilloscope. Other tasks are accomplished by combining these basic functions.

Languages for Program Examples The programming examples for individual commands in this manual are written in HPBASIC 6.3 or C.

1-2

Introduction to Programming Talking to the Instrument

Talking to the Instrument
Computers acting as controllers communicate with the instrument by sending and receiving messages over a remote interface. Instructions for programming normally appear as ASCII character strings embedded inside the output statements of a host language available on your controller. The input statements of the host language are used to read in responses from the oscilloscope. For example, HPBASIC uses the OUTPUT statement for sending commands and queries. After a query is sent, the response is usually read in using the ENTER statement. Messages are placed on the bus using an output command and passing the device address, program message, and terminator. Passing the device address ensures that the program message is sent to the correct interface and instrument. The following HP BASIC statement sends a command which turns on label display.
OUTPUT < device address > ;":CHANNEL1:BWLIMIT ON"

The < device address > represents the address of the device being programmed. Each of the other parts of the above statement are explained in the following pages.

1-3

Introduction to Programming Program Message Syntax

Program Message Syntax
To program the instrument remotely, you must understand the command format and structure expected by the instrument. The IEEE 488.2 syntax rules govern how individual elements such as headers, separators, program data, and terminators may be grouped together to form complete instructions. Syntax definitions are also given to show how query responses are formatted. The following figure shows the main syntactical parts of a typical program statement. Figure 1-1

Program Message Syntax

Output Command The output command is entirely dependent on the programming language. Throughout this manual, HPBASIC is used in most 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. The instructions listed in this manual are always shown between quotation marks in the example programs. Device Address The location where the device address must be specified is also dependent on the programming language you are using. In some languages, this may be specified outside the output command. In HP BASIC, this is always specified after the keyword OUTPUT. The examples in this manual assume the oscilloscope is at device address 707 . When writing programs, the address varies according to how the bus is configured.

1-4

Introduction to Programming Program Message Syntax

Instructions Instructions (both commands and queries) normally appear as a string 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 , such as . 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 provide additional information needed to clarify the meaning of the instruction. Instruction Header The instruction header is one or more mnemonics separated by colons (:) that represent the operation to be performed by the instrument. The command tree in chapter 5 illustrates how all the mnemonics can be joined together to form a complete header (see chapter 5, "Programming and Documentation Conventions"). The example in Figure 1-1 is a command. Queries are indicated 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 have included the question mark. The command and query forms of an instruction usually have different program data. Many queries do not use any program data. 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 space characters. ASCII defines a space to be character 32 (in decimal). Program Data Program data are used to clarify the meaning of the command or query. They provide 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, as well as the values they accept. The section "Program Data Syntax Rules" in this chapter has all of the general rules about acceptable values. When there is more than one data parameter, they are separated by commas(,). Spaces can be added around the commas to improve readability.

1-5

Introduction to Programming Program Message Syntax

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 instrument. The syntax is:


Simple command headers must occur at the beginning of a program message; if not, they must be preceded by a colon. When program data must be included with the simple command header (for example, :DIGITIZE CHANNEL1), white space is added to separate the data from the header. The syntax is:


Compound Command Header 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: To execute a single function within a subsystem:
::

(For example :CHANNEL1:BWLIMIT ON) Common Command Header Common command headers control IEEE 488.2 functions within the instrument (such as clear status). Their syntax is:
*

No space or separator is allowed between the asterisk (*) and the command header. *CLS is an example of a common command header.

1-6

Introduction to Programming Combining Commands from the Same Subsystem

Combining Commands from the Same Subsystem
To execute more than one function within the same subsystem, separate the functions with a semicolon (;):
::;

(For example :CHANNEL1:COUPLING DC;BWLIMIT ON)

1-7

Introduction to Programming Duplicate Mnemonics

Duplicate Mnemonics
Identical function mnemonics can be used in more than one subsystem. For example, the function mnemonic RANGE may be used to change the vertical range or to change the horizontal range:
:CHANNEL1:RANGE .4

sets the vertical range of channel 1 to 0.4 volts full scale.
:TIMEBASE:RANGE 1

sets the horizontal time base to 1 second full scale. CHANNEL1 and TIMEBASE are subsystem selectors and determine which range is being modified.

1-8

Introduction to Programming Query Command

Query Command
Command headers immediately followed by a question mark (?) are queries. After receiving a query, the instrument interrogates the requested function and places the answer in its output queue. The answer remains in the output queue until it is read or another command is issued. When read, the answer is transmitted across the bus to the designated listener (typically a controller). For example, the query :TIMEBASE:RANGE? places the current time base setting in the output queue. In HP BASIC, the controller input statement:
ENTER < device address > ;Range

passes the value across the bus to the controller and places it in the variable Range. Query commands are used to find out how the instrument is currently configured. They are also used to get results of measurements made by the instrument. For example, the command :MEASURE:RISETIME? instructs the instrument to measure the rise time of your waveform and places 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 that query 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.

Read the Query Result First Sending another command or query before reading the result of a query clears the output buffer and the current response. It also generates a query interrupted error in the error queue.

1-9

Introduction to Programming Program Header Options

Program Header Options
You can send program headers using any combination of uppercase or lowercase ASCII characters. Instrument responses, however, are always returned in uppercase. Program command and query headers may be sent in either long form (complete spelling), short form (abbreviated spelling), or any combination of long form and short form.
TIMEBASE:DELAY 1US - long form TIM:DEL 1US - short form

Programs written in long form are easily read and are almost self-documenting. The short form syntax conserves the amount of controller memory needed for program storage and reduces I/O activity.

Command Syntax Programming Rules The rules for the short form syntax are shown in chapter 5, "Programming and Documentation Conventions."

1-10

Introduction to Programming Program Data Syntax Rules

Program Data Syntax Rules
Program data is used to convey a parameter information related to the command header. At least one space must separate the command header or query header from the program data.


When a program mnemonic or query has multiple program data, a comma separates sequential program data.
,

For example, :CHANNEL:THRESHOLD POD1,TTL has two program data: POD1 and TTL. Two main types of program data are used in commands: character and numeric. Character Program Data Character program data is used to convey parameter information as alpha or alphanumeric strings. For example, the :TIMEBASE:MODE command can be set to normal, delayed, XY, or ROLL. The character program data in this case may be NORMAL, DELAYED, XY, or roll. The command :TIMEBASE:MODE DELAYED sets the time base mode to delayed. The available mnemonics for character program data are always included with the instruction's syntax definition. See the online Programmer's Reference for more information. When sending commands, you may either the long form or short form (if one exists). Uppercase and lowercase letters may be mixed freely. When receiving query responses, uppercase letters are used exclusively. 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 have the option of using exponential notation or using 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, that means that the number should be whole. Any fractional part be ignored, truncating the number. Numeric data parameters accept fractional values are called real numbers.

1-11

Introduction to Programming Program Data Syntax Rules

All numbers must be strings of ASCII characters. Thus, 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). This is handled automatically when you include the entire instruction in a string. Embedded Strings Embedded strings contain groups of alphanumeric characters, which are treated as a unit of data by the oscilloscope. For example, the line of text written to the advisory line of the instrument with the :SYSTEM:DSP command:
:SYSTEM:DSP "This is a message."

Embedded strings may be delimited with either single (') or double () quotes. These strings are case-sensitive, and spaces act as legal characters just like any other character.

1-12

Introduction to Programming Program Message Terminator

Program Message Terminator
The program instructions within a data message are executed after the program message terminator is received. The terminator may be either an NL (New Line) character, an EOI (End-Or-Identify) asserted in the GPIB interface, or a combination of the two. Asserting the EOI sets the EOI control line low on the last byte of the data message. The NL character is an ASCII linefeed (decimal 10).

New Line Terminator Functions The NL (New Line) terminator has the same function as an EOS (End Of String) and EOT (End Of Text) terminator.

1-13

Introduction to Programming Selecting Multiple Subsystems

Selecting Multiple Subsystems
You can send multiple program commands and program queries for different subsystems on the same line by separating each command with a semicolon. The colon following the semicolon enables you to enter a new subsystem. For example:
; : :CHANNEL1:RANGE 0.4;:TIMEBASE:RANGE 1

Combining Compound and Simple Commands Multiple commands may be any combination of compound and simple commands.

1-14

2

Programming Getting Started

Programming Getting Started

This chapter explains how to set up the instrument, how to retrieve setup information and measurement results, how to digitize a waveform, and how to pass data to the controller.

Languages for Programming Examples The programming examples in this manual are written in HPBASIC 6.3 or C.

2-2

Programming Getting Started Initialization

Initialization
To make sure the bus and all appropriate interfaces are in a known state, begin every program with an initialization statement. HP BASIC provides a CLEAR command which clears the interface buffer:
CLEAR 707 ! initializes the interface of the instrument

When you are using GPIB, CLEAR also resets the oscilloscope's parser. The parser is the program which reads in the instructions which you send it. After clearing the interface, initialize the instrument to a preset state:
OUTPUT 707;"*RST" state. ! initializes the instrument to a preset

Information for Initializing the Instrument The actual commands and syntax for initializing the instrument are discussed in the common commands section of the online Programmer's Reference. Refer to your controller manual and programming language reference manual for information on initializing the interface.

2-3

Programming Getting Started Autoscale

Autoscale
The AUTOSCALE feature performs a very useful function for unknown waveforms by setting up the vertical channel, time base, and trigger level of the instrument. The syntax for the autoscale function is:
:AUTOSCALE

2-4

Programming Getting Started Setting Up the Instrument

Setting Up the Instrument
A typical oscilloscope setup would set the vertical range and offset voltage, the horizontal range, delay time, delay reference, trigger mode, trigger level, and slope. An example of the commands that might be sent to the oscilloscope are:
:CHANNEL1:PROBE 10;RANGE 16;OFFSET 1.00 :TIMEBASE:MODE NORMAL;RANGE 1E-3;DELAY 100E-6

Vertical is set to 16V full-scale (2 V/div) with center of screen at 1V and probe attenuation set to 10. This example sets the time base at 1 ms full-scale (100 ms/div) with a delay of 100 ms.

2-5

Programming Getting Started Example Program

Example Program
This program demonstrates the basic command structure used to program the oscilloscope.
10 20 30 40 50 60 70 80 90 100 110 120 130 140 CLEAR 707 OUTPUT 707;"*RST" OUTPUT 707;":TIMEBASE:RANGE 5E-4" OUTPUT 707;":TIMEBASE:DELAY 0" OUTPUT 707;":TIMEBASE:REFERENCE CENTER" OUTPUT 707;":CHANNEL1:PROBE 10" OUTPUT 707;":CHANNEL1:RANGE 1.6" OUTPUT 707;":CHANNEL1:OFFSET -.4" OUTPUT 707;":CHANNEL1:COUPLING DC" OUTPUT 707;":TRIGGER:SWEEP NORMAL" OUTPUT 707;":TRIGGER:LEVEL -.4" OUTPUT 707;":TRIGGER:SLOPE POSITIVE" OUTPUT 707;":ACQUIRE:TYPE NORMAL" END ! ! ! ! ! ! ! ! ! ! ! ! ! Initialize instrument interface Initialize to preset state Time base to 50 us/div Delay to zero Display reference at center Probe attenuation to 10:1 Vertical range to 1.6 V full scale Offset to -0.4 Coupling to DC Normal triggering Trigger level to -0.4 Trigger on positive slope Normal acquisition

· Line 10 initializes the instrument interface to a known state. · Line 20 initializes the instrument to a preset state. · Lines 30 through 50 set the time base mode to normal with the horizontal time at 50 ms/div with 0 s of delay referenced at the center of the graticule. · Lines 60 through 90 set the vertical range to 1.6 volts full scale with center screen at -0.4 volts with 10:1 probe attenuation and DC coupling. · Lines 100 through 120 configure the instrument to trigger at -0.4 volts with normal triggering. · Line 130 configures the instrument for normal acquisition.

2-6

Programming Getting Started Using the DIGitize Command

Using the DIGitize Command
The DIGitize command is a macro that captures data satisfying the specifications set up by the ACQuire subsystem. When the digitize process is complete, the acquisition is stopped. The captured data can then be measured by the instrument or transferred to the controller for further analysis. The captured data consists of two parts: the waveform data record and the preamble.

Ensure New Data is Collected When you change the oscilloscope configuration, the waveform buffers are cleared. Before doing a measurement, send the DIGitize command to the oscilloscope to ensure new data has been collected. When you send the DIGitize command to the oscilloscope, the specified channel signal is digitized with the current ACQuire parameters. To obtain waveform data, you must specify the WAVEFORM parameters for the waveform data prior to sending the :WAVEFORM:DATA? query.

Set :TIMebase:MODE to NORMal when using :DIGitize :TIMebase:MODE must be set to NORMal to perform a :DIGitize command or to perform any WAVeform subsystem query. A "Settings conflict" error message will be returned if these commands are executed when MODE is set to ROLL, XY, or DELayed. Sending the *RST (reset) command will also set the time base mode to normal. The number of data points comprising a waveform varies according to the number requested in the ACQuire subsystem. The ACQuire subsystem determines the number of data points, type of acquisition, and number of averages used by the DIGitize command. This allows you to specify exactly what the digitized information contains.

2-7

Programming Getting Started Using the DIGitize Command

The following program example shows a typical setup:
OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT 707;":ACQUIRE:TYPE AVERAGE" 707;":ACQUIRE:COMPLETE 100" 707;":WAVEFORM:SOURCE CHANNEL1" 707;":WAVEFORM:FORMAT BYTE" 707;":ACQUIRE:COUNT 8" 707;":WAVEFORM:POINTS 500" 707;":DIGITIZE CHANNEL1" 707;":WAVEFORM:DATA?"

This setup places the instrument into the averaged mode with eight averages. This means that when the DIGitize command is received, the command will execute until the signal has been averaged at least eight times. After receiving the :WAVEFORM:DATA? query, the instrument will start passing the waveform information when addressed to talk. Digitized waveforms are passed from the instrument to the controller by sending a numerical representation of each digitized point. The format of the numerical representation is controlled with the :WAVEFORM:FORMAT command and may be selected as BYTE, WORD, or ASCII. The easiest method of transferring a digitized waveform depends on data structures, formatting available and I/O capabilities. You must scale the integers to determine the voltage value of each point. These integers are passed starting with the leftmost point on the instrument's display. For more information, see the waveform subsystem commands and corresponding program code examples in the online Programmer's Reference.

Aborting a Digitize Operation Over GPIB When using GPIB, you can abort a digitize operation by sending a Device Clear over the bus (CLEAR 707).

2-8

Programming Getting Started Receiving Information from the Instrument

Receiving Information from the Instrument
After receiving a query (command header followed by a question mark), the instrument interrogates the requested function and places the answer in its output queue. The answer remains in the output queue until it is read or another command is issued. When read, the answer is transmitted across the interface to the designated listener (typically a controller). The input statement for receiving a response message from an instrument's output queue typically has two parameters; the device address, and a format specification for handling the response message. For example, to read the result of the query command :CHANNEL1:COUPLING? you would execute the HP BASIC statement:
ENTER ;Setting$

where represents the address of your device. This would enter the current setting for the channel one coupling in the string variable Setting$. All results for queries sent in a program message must be read before another program message is sent. For example, when you send the query :MEASURE:RISETIME?, you must follow that query with an input statement. In HP BASIC, this is usually done with an ENTER statement. Sending another command before reading the result of the query clears the output buffer and the current response. This also causes an error to be placed in the error queue. Executing an input statement before sending a query causes the controller to wait indefinitely. The format specification for handling response messages is dependent on both the controller and the programming language.

2-9

Programming Getting Started String Variables

String Variables
The output of the instrument may be numeric or character data depending on what is queried. Refer to the specific commands for the formats and types of data returned from queries. Express String Variables Using Exact Syntax In HP BASIC 6.3, string variables are case sensitive and must be expressed exactly the same each time they are used.

Address Varies According to Configuration For the example programs in the help file, assume that the device being programmed is at device address 707. The actual address varies according to how you configured the bus for your own application. The following example shows the data being returned to a string variable:
10 20 30 40 50 DIM Rang$[30] OUTPUT 707;":CHANNEL1:RANGE?" ENTER 707;Rang$ PRINT Rang$ END

After running this program, the controller displays:
+40.0E-00

2-10

Programming Getting Started Numeric Variables

Numeric Variables
The following example shows the data being returned to a numeric variable:
10 20 30 40 OUTPUT 707;":CHANNEL1:RANGE?" ENTER 707;Rang PRINT Rang END

After running this program, the controller displays:
40

2-11

Programming Getting Started Definite-Length Block Response Data

Definite-Length Block Response Data
Definite-length block response data allows any type of device-dependent data to be transmitted over the system interface as a series of 8-bit binary data bytes. This is particularly useful for sending large quantities of data or 8-bit extended ASCII codes. The syntax is a pound sign ( # ) followed by a non-zero digit representing the number of digits in the decimal integer. After the non-zero digit is the decimal integer that states the number of 8-bit data bytes being sent. This is followed by the actual data. For example, for transmitting 4000 bytes of data, the syntax would be: Figure 2-1

Definite-length block response data

The "8" states the number of digits that follow, and "00004000" states the number of bytes to be transmitted.

2-12

Programming Getting Started Multiple Queries

Multiple Queries
You can send multiple queries to the instrument within a single program message, but you must also read them back within a single program message. This can be accomplished by either reading them back into a string variable or into multiple numeric variables. For example, you could read the result of the query :TIMEBASE:RANGE?;DELAY? into the string variable Results$ with the command:
ENTER 707;Results$

When you read the result of multiple queries into string variables, each response is separated by a semicolon. For example, the response of the query :TIMEBASE:RANGE?;DELAY? would be:
;

Use the following program message to read the query :TIMEBASE:RANGE?;DELAY? into multiple numeric variables and then display them:
ENTER 707;Result1,Result2 PRINT 707;Result1,Result2

Instrument Status
Status registers track the current status of the instrument. By checking the instrument status, you can find out whether an operation has been completed, whether the instrument is receiving triggers, and more. Chapter 6, "Status Reporting" explains how to check the status of the instrument.

2-13

2-14

3

Programming over GPIB

Programming over GPIB

This section describes the GPIB interface functions and some general concepts. In general, these functions are defined by IEEE 488.1. They deal with general interface management issues, as well as messages which can be sent over the interface as interface commands. For more information on connecting the controller to the oscilloscope, see the documentation for the GPIB interface card you are using. The optional Agilent N2757A GPIB Interface Module must be connected to the oscilloscope to allow programming over GPIB.

3-2

Programming over GPIB Interface Capabilities

Interface Capabilities
The interface capabilities of the oscilloscope, as defined by IEEE 488.1, are SH1, AH1, T5, L4, SR1, RL1, PP0, DC1, DT1, C0, and E2.

Command and Data Concepts
The interface has two modes of operation: · command mode · data mode The bus is in the command mode when the ATN line is true. The command mode is used to send talk and listen addresses and various bus commands, such as a group execute trigger (GET). The bus is in the data mode when the ATN line is false. The data mode is used to convey device-dependent messages across the bus. The device-dependent messages include all of the instrument commands and responses.

3-3

Programming over GPIB Addressing

Addressing
To set up the GPIB interface (optional Agilent N2757A GPIB Interface Module must be connected to the oscilloscope), refer to the "To set up the I/O port to use a controller" topic in the Utilities chapter of the User's Guide. · Each device on the GPIB resides at a particular address, ranging from 0 to 30. · The active controller specifies which devices talk and which listen. · An instrument may be talk addressed, listen addressed, or unaddressed by the controller. If the controller addresses the instrument to talk, the instrument remains configured to talk until it receives an interface clear message (IFC), another instrument's talk address (OTA), its own listen address (MLA), or a universal untalk command (UNT). If the controller addresses the instrument to listen, the instrument remains configured to listen until it receives an interface clear message (IFC), its own talk address (MTA), or a universal unlisten command (UNL).

3-4

Programming over GPIB Communicating Over the Bus

Communicating Over the Bus
Because GPIB can address multiple devices through the same interface card, the device address passed with the program message must include not only the correct interface select code, but also the correct instrument address. Interface Select Code (Selects Interface) Each interface card has a unique interface select code. This code is used by the controller to direct commands and communications to the proper interface. The default is typically 7 for GPIB controllers. Instrument Address (Selects Instrument) Each instrument on an GPIB must have a unique instrument address between decimal 0 and 30. The device address passed with the program message must include not only the correct instrument address, but also the correct interface select code. DEVICE ADDRESS = (Interface Select Code * 100) + (Instrument Address) For example, if the instrument address for the oscilloscope is 4 and the interface select code is 7, when the program message is passed, the routine performs its function on the instrument at device address 704. For the oscilloscope, the instrument address is typically set to 707.

Oscilloscope Device Address The examples in this manual and in the online Programmer's Reference assume the oscilloscope is at device address 707. See the documentation for your GPIB interface card for more information on select codes and addresses.

3-5

Programming over GPIB Lockout

Lockout
With GPIB, the instrument is placed in the lockout mode by sending the local lockout command (LLO). The instrument can be returned to local by sending the go-to-local (GTL) command to the instrument.

Bus Commands
The following commands are IEEE 488.1 bus commands (ATN true). IEEE 488.2 defines many of the actions which are taken when these commands are received by the instrument. Device Clear The device clear (DCL) or selected device clear (SDC) commands clear the input and output buffers, reset the parser, and clear any pending commands. If you send either of these commands during a digitize operation, the digitize operation is aborted. Interface Clear (IFC) The interface clear (IFC) command halts all bus activity. This includes unaddressing all listeners and the talker, disabling serial poll on all devices, and returning control to the system controller.

3-6

4

Programming over RS-232-C

Programming over RS-232-C

This section describes the interface functions and some general concepts of the RS-232-C interface. The RS-232-C interface on this instrument is Hewlett-Packard's implementation of EIA Recommended Standard RS-232-C, Interface Between Data Terminal Equipment and Data Communications Equipment Employing Serial Binary Data Interchange. With this interface, data is sent one bit at a time and characters are not synchronized with preceding or subsequent data characters. Each character is sent as a complete entity without relationship to other events.

IEEE 488.2 Operates with IEEE 488.1 or RS-232-C IEEE 488.2 is designed to work with IEEE 488.1 as the physical interface. When RS-232-C is used as the physical interface, as much of IEEE 488.2 is retained as the hardware differences will allow. No IEEE 488.1 messages such as DCL, GET, and END are available.

4-2

Programming over RS-232-C Interface Operation

Interface Operation
The oscilloscope can be programmed with a controller over RS-232-C using either a minimum three-wire or extended hardwire interface. The operation and exact connections for these interfaces are described in more detail in subsequent sections of this chapter. When you are programming the oscilloscope over RS-232-C with a controller, you are normally operating directly between two DTE (Data Terminal Equipment) devices as compared to operating between a DTE device and a DCE (Data Communications Equipment) device. When operating directly between two RS-232-C devices, certain considerations must be taken into account. For three-wire operation, an XON/XOFF software handshake must be used to handle handshaking between the devices. For extended hardwire operation, handshaking may be handled either with XON/XOFF or by manipulating the CTS and RTS lines of the oscilloscope. For both three-wire and extended hardwire operation, the DCD and DSR inputs to the oscilloscope must remain high for proper operation. With extended hardwire operation, a high on the CTS input allows the oscilloscope to send data and a low on this line disables the oscilloscope data transmission. Likewise, a high on the RTS line allows the controller to send data and a low on this line signals a request for the controller to disable data transmission. Because three-wire operation has no control over the CTS input, internal pull-up resistors in the oscilloscope ensure that this line remains high for proper three-wire operation.

Cables
Selecting a cable for the RS-232-C interface is dependent on your specific application. The following paragraphs describe which lines of the oscilloscope are used to control the operation of the RS-232-C bus relative to the oscilloscope. To locate the proper cable for your application, refer to the reference manual for your controller. This manual should address the exact method your controller uses to operate over the RS-232-C bus.

4-3

Programming over RS-232-C Minimum Three-Wire Interface with Software Protocol

Minimum Three-Wire Interface with Software Protocol
With a three-wire interface, the software (as compared to interface hardware) controls the data flow between the oscilloscope and the controller. This provides a much simpler connection between devices because you can ignore hardware handshake requirements. The oscilloscope uses the following connections on its RS-232-C interface for three-wire communication: · Pin 7 SGND (Signal Ground) · Pin 2 TD (Transmit Data from oscilloscope) · Pin 3 RD (Receive Data into oscilloscope) The TD (Transmit Data) line from the oscilloscope must connect to the RD (Receive Data) line on the controller. Likewise, the RD line from the oscilloscope must connect to the TD line on the controller. Internal pull-up resistors in the oscilloscope ensure the DCD, DSR, and CTS lines remain high when you are using a three-wire interface.

No Hardware Means to Control Data Flow The three-wire interface provides no hardware means to control data flow between the controller and the oscilloscope. XON/OFF protocol is the only means to control this data flow.

4-4

Programming over RS-232-C Extended Interface with Hardware Handshake

Extended Interface with Hardware Handshake
With the extended interface, both the software and the hardware can control the data flow between the oscilloscope and the controller. This allows you to have more control of data flow between devices. The oscilloscope uses the following connections on its RS-232-C interface for extended interface communication (on a 25-pin connector): · Pin 7 SGND (Signal Ground) · Pin 2 TD (Transmit Data from oscilloscope) · Pin 3 RD (Receive Data into oscilloscope) The additional lines you use depends on your controller's implementation of the extended hardwire interface. · Pin 4 RTS (Request To Send) is an output from the oscilloscope which can be used to control incoming data flow. · Pin 5 CTS (Clear To Send) is an input to the oscilloscope which controls data flow from the oscilloscope. · Pin 6 DSR (Data Set Ready) is an input to the oscilloscope which controls data flow from the oscilloscope within two bytes. · Pin 8 DCD (Data Carrier Detect) is an input to the oscilloscope which controls data flow from the oscilloscope within two bytes. · Pin 20 DTR (Data Terminal Ready) is an output from the oscilloscope which is enabled as long as the oscilloscope is turned on.

4-5

Programming over RS-232-C Configuring the Interface

The TD (Transmit Data) line from the oscilloscope must connect to the RD (Receive Data) line on the controller. Likewise, the RD line from the oscilloscope must connect to the TD line on the controller. The RTS (Request To Send) line is an output from the oscilloscope which can be used to control incoming data flow. A high on the RTS line allows the controller to send data, and a low on this line signals a request for the controller to disable data transmission. The CTS (Clear To Send), DSR (Data Set Ready), and DCD (Data Carrier Detect) lines are inputs to the oscilloscope which control data flow from the oscilloscope (Pin 2). Internal pull-up resistors in the oscilloscope assure the DCD and DSR lines remain high when they are not connected. If DCD or DSR are connected to the controller, the controller must keep these lines and the CTS line high to enable the oscilloscope to send data to the controller. A low on any one of these lines will disable the oscilloscope data transmission. Dropping the CTS line low during data transmission will stop oscilloscope data transmission immediately. Dropping either the DSR or DCD line low during data transmission will stop oscilloscope data transmission, but as many as two additional bytes may be transmitted from the oscilloscope.

Configuring the Interface
Use the controller mode when you operate the instrument with a controller over RS-232-C. To set up the RS-232-C interface on the oscilloscope, refer to the "To set up the I/O port to use a controller" topic in the Utilities chapter of the User's Guide. Make sure that the RS-232-C settings on your oscilloscope match the settings of your COM1 or COM2 port on your pc.

4-6

Programming over RS-232-C Interface Capabilities

Interface Capabilities
The baud rate, stop bits, parity, handshake protocol, and data bits must be configured exactly the same for both the controller and the oscilloscope to properly communicate over the RS-232-C bus. The oscilloscope's RS-232-C interface capabilities are as follows: · Baud Rate: 9600, 19,200, 38,400, or 57,600 · Stop Bits: preset to 1 · Parity: preset to None · Protocol: DTR or XON/XOFF · Data Bits: preset to 8 Protocol DTR (Data Terminal Ready) With a three-wire interface, selecting DTR for the handshake protocol does not allow the sending or receiving device to control data flow. No control over the data flow increases the possibility of missing data or transferring incomplete data. With an extended hardwire interface, selecting DTR allows a hardware handshake to occur. With hardware handshake, hardware signals control data flow. XON/XOFF XON/XOFF stands for Transmit On/Transmit Off. With this mode the receiver (controller or oscilloscope) controls data flow and can request that the sender (oscilloscope or controller) stop data flow. By sending XOFF (ASCII 17) over its transmit data line, the receiver requests that the sender disables data transmission. A subsequent XON (ASCII 19) allows the sending device to resume data transmission. A controller sending data to the oscilloscope should send no more than 32 bytes of data after an XOFF. The oscilloscope will not send any data after an XOFF is received until an XON is received. Data Bits Data bits are the number of bits sent and received per character that represent the binary code of that character. Information is stored in bytes (8 bits at a time) in the oscilloscope. Data can be sent and received just as it is stored, without the need to convert the data.

4-7

Programming over RS-232-C Lockout Command

Lockout Command
To lockout the front panel controls use the system command LOCK. When this function is on, all controls (except the power switch) are entirely locked out. Local control can only be restored by sending the command :SYSTEM:LOCK OFF. Restoring Local Control Cycling the power will also restore local control, but this will also reset certain RS-232-C states.

4-8

5

Programming and Documentation Conventions

Programming and Documentation Conventions

This chapter covers conventions used in programming the instrument, as well as conventions used in the online Programmer's Reference and the remainder of this manual. This chapter also contains a detailed description of the command tree and command tree traversal.

5-2

Programming and Documentation Conventions Command Set Organization

Command Set Organization
The command set is divided into common commands, root level commands and sets of subsystem commands. Each of the groups of commands is described in the Programmer's Reference, which is supplied as an online help file for Microsoft Windows. See chapter 7, "Installing and Using the Programmer's Reference" for information on installing and using the help file. The commands shown use upper and lowercase letters. As an example, AUToscale indicates that the entire command name is AUTOSCALE. To speed up the transfer, the short form AUT is also accepted by the oscilloscope. Each command listing contains a description of the command and its arguments and command syntax. Some commands have a programming example. The subsystems are listed below:
Subsystem ACQuire CALibrate CHANnel Common DIGital DISPlay EXTernal FUNCtion HARDcopy MARKer MEASure POD Root SYStem TIMebase TRIGger WAVeform Description sets the parameters for acquiring and storing data provides utility commands for determining the state of the calibration factor protection switch controls all oscilloscope functions associated with individual analog channels or groups of channels commands defined by IEEE 488.2 standard common to all instruments controls all oscilloscope functions associated with individual digital channels controls how waveforms, graticule, and text are displayed and written on the screen controls the input characteristics of the external trigger input controls functions in the Measurement/Storage Module provides commands to set and query the selection of hardcopy device and formatting options provides commands to set and query the settings of X-axis markers (X1 and X2 cursors) and the Y-axis markers (Y1 and Y2 cursors). selects automatic measurements to be made and controls time markers controls all oscilloscope functions associated with groups of digital channels. controls many of the basic functions of the oscilloscope and reside at the root of the command tree controls some basic functions of the oscilloscope controls all horizontal sweep functions controls the trigger modes and parameters for each trigger type provides access to waveform data

5-3

Programming and Documentation Conventions Command Set Organization

Table 5-1 Alphabetic Command Reference
Command ACTivity ACTivity ADDRess AER AUToscale BAUDrate BLANk BWLimit BWLimit BYTeorder CDISplay CENTer CLEAR CLOCk CLOCk *CLS COMPlete CONNect COUNt COUNt COUNter COUPling COUPling DATA DATA DATA DATA DATA DATA DATE DATE DEFine DEFinition DELay DELay DESTinatin DEVice DIGitize Subsystem Where used CHANnel Root level TRIGger:IIC:PATTern Root level Root level TRIGger:CAN:SIGNal Root level CHANnel EXTernal WAVeform Root FUNCtion MEASure TRIGger:IIC:SOURce TRIGger:SPI:SOURce Common ACQuire DISPlay TRIGger:SEQuence WAVeform MEASure CHANnel TRIGger:EDGE DISPlay TRIGger:IIC:PATTern TRIGger:IIC:SOURce TRIGger:SPI:PATTERN TRIGger:SPI:SOURce WAVeform CALibrate SYSTem MEASure TRIGger:CAN:SIGNal MEASure TIMebase HARDcopy HARDcopy Root level Command DISPlay DISPlay DISPlay DISPlay *DMC DMINus DPLus DSP DUTycycle DURation EDGE *EMC ERASe ERRor *ESE *ESR FACTors FALLtime FFEed FIND FORMat FORMat FRAMe FRAMing FREQuency *GMC GRAYscale GREaterthan GREaterthan HFReject HOLDoff *IDN IMPedance IMPedance INPut INVert Subsystem Where used CHANnel DIGital FUNCtion POD Common TRIGger:USB:SOURce TRIGger:USB:SOURce SYSTem MEASure TRIGger:GLITch TRIGger:SEQuence Common Root level SYSTem Common Common HARDcopy MEASure HARDcopy TRIGger:SEQuence HARDcopy WAVeform TRIGger:SPI:SOURce TRIGger:SPI MEASure Common HARDcopy TRIGger:DURation TRIGger:GLITch TRIGger TRIGger Common CHANnel EXTernal CHANnel CHANnel Command LABel LABel LABel LABel LABel LABList LESSthan LESSthan LEVel LINE *LMC LOCK *LRN MERGe MODE MODE MODE MODE MODE NREJect NWIDth OFFSet OFFSet *OPC OPEE OPER *OPT ORDer OVERshoot PERiod PERSistence PHASe *PMC PMODe POINts POINts Subsystem Where used CALibrate CHANnel CHANnel DIGital DISPLay DISPlay TRIGger:DURation TRIGger:GLITch TRIGger:EDGE TRIGger:TV Common SYSTem Common Root level ACQuire MARKer TIMebase TRIGger TRIGger:TV TRIGger MEASure CHANnel FUNCtion Common Root level Root level Common DISPlay MEASure MEASure DISPlay MEASure Common CHANnel ACQuire WAVeform

5-4

Programming and Documentation Conventions Command Set Organization

Command POLarity POLarity POSition POSition POSition PREamble PREShoot PRINt PROBe PROBe PWIDth QUALifier QUALifier QUALifier RANGe RANGe RANGe RANGe RANGe RANGe RANGe *RCL REFerence REFerence REJect RESet RISetime *RST RUN *SAV SCALe SCALe SCALe SCALe SCRatch SERial SETup SHOW SINGle SLOPe SLOPe

Subsystem Where used TRIGger:TV TRIGger:GLITch DIGital TIMebase TIMebase:WINDow WAVeform MEASure Root level CHANnel EXTernal MEASure TRIGger:DURation TRIGger:GLITch TRIGger:IIC:TRIGer CHANnel EXTernal FUNCtion TIMebase TIMebase:WINDow TRIGger:DURAtion TRIGger:GLITch Common FUNCtion TIMebase TRIGger:EDGE TRIGger:SEQuence MEASure Common Root level Common CHANnel FUNCtion TIMebase TIMebase:WINDow MEASure Root level SYSTem MEASure Root level TRIGger:EDGE TRIGger:SPI:CLOCk

Command SOUrce SOURce SOURce SOURce SOURce SOURce SOURce SPAN SPEed SRATe *SRE STANdard STATus *STB STOP SWEep SWITch TEDGe TER THReshold THReshold THReshold THReshold TIMer TIMeout *TRG TRIGger TRIGger TRIGger TRIGger *TST TVALue TVMode TVOLt TYPE TYPE TYPE UNITs UNITs UNSigned VAMPlitude

Subsystem Where used DISPlay FUNCtion MEASure TRIGger:CAN TRIGger:GLITch TRIGger:TV WAVeform FUNCtion TRIGger:USB ACQuire Common TRIGger:TV Root level Common Root level TRIGger CALibrate MEASure Root level CHANnel DIGital POD TRIGger TRIGger:SEQuence TRIGger:SPI:CLOCk Common TRIGger:CAN TRIGger:IIC TRIGger:SEQuence TRIGger:USB Common MEASure TRIGger:TV MEASure ACQuire WAVeform TRIGger:IIC:TRIGger CHANnel EXTernal WAVeform MEASure

Command VAVerage VBASe VECTors VIEW VIEW VIEW VMAX VMIN VPP VRMS VTIMe VTOP *WAI WIDth WINDow X1Position X1Y1source X2Position X2Y2source XDELta XINCrement XMAX XMIN XORigin XREFerence Y1Position X1Y1source Y2Position YDELta YINCrement YORigin YREFerence

Subsystem Where used MEASure MEASure DISPlay FUNCtion Root level WAVeform MEASure MEASure MEASure MEASure MEASure MEASure Common TRIGger:SPI:PATTERN FUNCtion MARKer MARKer MARKer MARKer MARKer WAVeform MEASure MEASure WAVeform WAVeform MARKer MARKer MARKer MARKer WAVeform WAVeform WAVeform

5-5

Programming and Documentation Conventions The Command Tree

The Command Tree
The command tree shows all of the commands and the relationships of the commands to each other. The IEEE 488.2 common commands are not listed as part of the command tree because they do not affect the position of the parser within the tree. When a program message terminator (, linefeed-ASCII decimal 10) or a leading colon (:) is sent to the instrument, the parser is set to the root of the command tree. Command Types The commands for this instrument are in three categories: · Common commands · Root level commands · Subsystem commands Common Commands The common commands are the commands defined by IEEE 488.2. These commands control some functions that are common to all IEEE 488.2 instruments. Common commands are independent of the tree, and do not affect the position of the parser within the tree. These commands differ from root level commands in that root level commands place the parser back at the root of the command tree. Example:
*RST

Root Level Commands The root level commands control many of the basic functions of the instrument. These commands reside at the root of the command tree. Root level commands are always parsable if they occur at the beginning of a program message, or are preceded by a colon. Example:
:AUTOSCALE

5-6

Programming and Documentation Conventions The Command Tree

Ã

68Uvv 6@S 6VUphyr 7G6Ix 89DTyh 9DBvvr H@SBr PQ@@ PQ@S QSDI SVI T@Svhy TDIByr TU6U TUPQ U@S WD@X

T`TUr) 96U@ 9TQ @SS GP8F T@U UDH@

68Rvr) 8PHQyrr 8PVI HP9@ QPDI TS6Ur U`Q@

86Gvihr) 96U@ G67ry TXDUpu U@HQrhr UDH@

8C6Iry13) 7XGvv 8PVQyvt 9DTQyh DHQrqhpr DIWr G67ry PAATr QSP7r S6IBr T86Gr VIDU

9DBvhy13) 9DTQyh G67ry QPTvv UCSruyq

9DTQyh) 8G@h 96U6 G67ry G67Gv PS9r Q@STvrpr TPVSpr W@8

@YUrhy) 7XGvv DHQrqhpr QSP7r S6IBr VIDU

8Ã8hqÃD@@@Ã#''! 8GT @H8 @T@ @TS BH8 GH8 GSI PQ8 PQU QH8 S8G STU T6W TS@ TU7 USB UTU X6D

9H8 D9I

AVI8v) 8@IUr 9DTQyh PAATr PQ@Shv S6IBr S@Arrpr T86Gr TPVSpr TQ6I XDI9

C6S9p) 9@TUvhv A68U AA@rq APSHh BS6`phyr

H6SFr) HP9@ Y Qvv Y!Qv Y9ryh ` Qv `!Qvv `9@Gh Y ` pr Y!`!pr 8G@hÃ

H@6Tr) TPVSpr U@9Br UW6Gr W6HQyvqr W6Wrhtr W76Tr WH6Y WHDI WQQ WSHT WUDHr WUPQ YH6Y YHDI

QP9) 9DTQyh UCSruyq

UDHrihr) HP9@ QPTvv S6IBr S@Arrpr T86Gr XDI9) ÃÃÃÃQPTvv ÃÃÃÃS6IBr ÃÃÃÃT86Gr

X6Wrs) 7`Urqr 8PVI 96U6 APSHh QPDI QS@hiyr TPVSpr U`Q@ VITvtrq WD@X YDI8rr YPSvtv YS@Arrpr `DI8rr `PSvtv `S@Arrpr

8PVIr 9@Avr 9@Gh 9VU`ppyrà A6GGvrà AS@Rrpà IXD9uà PW@Suà Q@Svqà QC6Tr QS@Tu QXD9uà SDTrvrà TCPXÃ

USDBtr)

CASrwrp CPG9ss HP9@ IS@Erp Q6UUr TX@r

86I) ÃÃÃÃTDBIhy) ÃÃÃÃÃÃÃ76V9hr ÃÃÃÃÃÃÃ9@Avvv ÃÃÃÃTPVSpr ÃÃÃÃUSDBtr

9VShv) ÃÃÃÃBS@hruh ÃÃÃÃG@TTuh ÃÃÃÃQ6UUr ÃÃÃÃRV6Gvsvr ÃÃÃÃS6IBr

@9B@) ÃÃÃÃ8PVQyvt ÃÃÃÃG@Wry ÃÃÃÃS@Erp ÃÃÃÃTGPQr ÃÃÃÃTPVSpr

BGDUpu) ÃÃÃÃBS@hruh ÃÃÃÃG@TTuh ÃÃÃÃG@Wry ÃÃÃÃQPGhv ÃÃÃÃRV6Gvsvr ÃÃÃÃS6IBr ÃÃÃÃTPVSpr

DD8) ÃÃÃÃUSDBtr) ÃÃÃÃÃÃÃU`Q@ ÃÃÃÃÃÃÃRV6Gvsvr ÃÃÃÃTPVSpr) ÃÃÃÃÃÃÃÃ8GP8x ÃÃÃÃÃÃÃÃ96U6 ÃÃÃÃQ6UUr) ÃÃÃÃÃÃÃÃ699Sr ÃÃÃÃÃÃÃÃ96U6

T@Rrpr) ÃÃÃÃ8PVI ÃÃÃÃ@9B@ ÃÃÃÃADI9 ÃÃÃÃQ6UUr ÃÃÃÃS@Tr ÃÃÃÃUDHr ÃÃÃÃUSDBtr

TQD) ÃÃÃÃ8GP8x) ÃÃÃÃÃÃÃÃTGPQr ÃÃÃÃÃÃÃÃUDHr ÃÃÃÃAS6Hvt ÃÃÃÃQ6UUr) ÃÃÃÃÃÃÃÃ96U6 ÃÃÃÃÃÃÃÃXD9u ÃÃÃÃTPVSpr) ÃÃÃÃÃÃÃÃ8GP8x ÃÃÃÃÃÃÃÃ96U6 ÃÃÃÃÃÃÃÃAS6HrÃ

UW) ÃÃÃÃGDI@ ÃÃÃÃHP9@ ÃÃÃÃQPGhv ÃÃÃÃTPVSpr ÃÃÃÃTU6Iqhq

VT7) ÃÃÃÃTPVSpr) ÃÃÃÃÃÃÃ9HDI ÃÃÃÃÃÃÃ9QG ÃÃÃÃTQ@rq ÃÃÃÃUSDBtr ÃÃÃÃ

Ir)ÃÃTrÃphqÃhrÃrpvsvpÃÃurÃvrqvthyÃpvyyprà 8yÃurÃyvrÃQthrÃSrsrrprÃsÃrÃvshv
FPGFGU

5-7

Programming and Documentation Conventions The Command Tree

Subsystem Commands Subsystem commands are grouped together under a common node of the command tree, such as the TIMEBASE commands. Only one subsystem may be selected at any given time. When the instrument is initially turned on, the command parser is set to the root of the command tree, therefore, no subsystem is selected. Tree Traversal Rules Command headers are created by traversing down the command tree. A legal command header from the command tree would be :CHANNEL1:RANGE. This is called a compound header. A compound header is a header made of two or more mnemonics separated by colons. The mnemonic created contains no spaces. The following rules apply to traversing the tree: · A leading colon or a (either an or EOI true on the last byte) places the parser at the root of the command tree. A leading colon is a colon that is the first character of a program header. · Executing a subsystem command places you in that subsystem until a leading colon or a is found. In the Command Tree, use the last mnemonic in the compound header as a reference point (for example, RANGE). Then find the last colon above that mnemonic (CHANNEL). That is the point where the parser resides. Any command below that point can be sent within the current program message without sending the mnemonics that appear above them (for example, OFFSET). Examples The OUTPUT statements in the examples are written using HPBASIC 6.3. The quoted string is placed on the bus, followed by a carriage return and linefeed (CRLF). Example 1:
OUTPUT 707;":CHANNEL1:RANGE 0.5 ;OFFSET 0"

The colon between CHANNEL1 and RANGE is necessary because CHANNEL1:RANGE is a compound command. The semicolon between the RANGE command and the OFFSET command is the required program message unit separator. The OFFSET command does not need CHANNEL1 preceding it, since the CHANNEL1:RANGE command sets the parser to the CHANNEL1 node in the tree.

5-8

Programming and Documentation Conventions The Command Tree

Example 2:
OUTPUT 707;":TIMEBASE:REFERENCE CENTER ; DELAY 0.00001"

or
OUTPUT 707;":TIMEBASE:REFERENCE CENTER" OUTPUT 707;":TIMEBASE:DELAY 0.00001"

or
OUTPUT 707;":TIMEBASE:REFERENCE CENTER; :TIMEBASE:DELAY 0.00001"

In the first line of example 2, the subsystem selector is implied for the DELAY command in the compound command. The DELAY command must be in the same program message as the REFERENCE command, since the program message terminator places the parser back at the root of the command tree. Example 3:
OUTPUT 707;":TIMEBASE:REFERENCE CENTER; :CHANNEL1:OFFSET '0'"

The leading colon before CHANNEL1 tells the parser to go back to the root of the command tree. The parser can then see the CHANNEL1:OFFSET command.

5-9

Programming and Documentation Conventions Obsolete and Discontinued Commands

Obsolete and Discontinued Commands
Core Commands Core commands are a common set of commands that provide basic oscilloscope functionality on this oscilloscope and future Agilent 54600-series oscilloscopes. Core commands are unlikely to modified in the future. If you restrict your programs to core commands, the programs should work across product offerings in the future, assuming appropriate programming methods are employed.

Non-Core Commands Non-core commands are commands that provide specific features, but are not universal across all oscilloscope models. Non-core commands may be modified or deleted in the future. With a command structure as complex as the 54621A/21D/22A/22D/24A, some evolution over time is inevitable. Agilent's intent is to continue to expand command subsystems, such as the rich and evolving trigger feature set.

5-10

Programming and Documentation Conventions Obsolete and Discontinued Commands

Obsolete Commands Obsolete commands are older forms of commands that are provided to reduce customer rework for existing systems and programs. Generally, these commands are mapped onto some of the Core and Non-core commands, but may not strictly have the same behavior as the new command. None of the obsolete commands are guaranteed to functional in future products. New systems and programs should use the Core (and Non-core) commands. Obsolete Commands
Obsolete Command ANALog:BWLimit ANALog:COUPling ANALog:INVert ANALog:LABel ANALog:OFFSet ANALog:PROBe ANALog:PMODe ANALog:RANGe CHANnel:ACTivity CHANnel:LABel CHANnel:THReshold CHANnel:PMODe ERASe DISPlay:CONNect FUNCtion1, FUNCtion2 FUNCtion:VIEW HARDcopy:DEVice Current Command Equivalent CHANnel:BWLimit CHANnel:COUPling CHANnel:INVert CHANnel:LABel CHANnel:OFFSet CHANnel:PROBe none CHANnel:RANGe ACTivity CHANnel:LABel or DIGital:LABel POD:THReshold or DIGital:THReshold none CDISplay DISPlay:VECTors FUNCtion subsystem FUNCtion:DISPlay HARDcopy:FORMat PLOTter, THINkjet not supported; TIF, BMP, CSV, SEIko added ADD not included use CHANnel:LABel for analog channels and use DIGital:LABel for digital channels Behavior Differences

5-11

Programming and Documentation Conventions Obsolete and Discontinued Commands

Obsolete Command MEASure:SCRatch MEASure:TDELta MEASure:TMAX MEASure:TMIN MEASure:TSTArt MEASure:TSTOp MEASure:TVOLt MEASure:VDELta MEASure:VSTArt MEASure:VSTOp TIMebase:DELay

Current Command Equivalent MEASure:CLEar MARKer:TDELta MEASure:XMAX MEASure:XMIN MARKer:X1Position MARKer:X2Position MEASure:TVALue MARKer:VDELta MARKer:Y1Position MARKer:Y2Position TIMebase:POSition or TIMebase:WINDow:POSition POD:THREshold or DIGital:THREshold TRIGger:TV:MODE

Behavior Differences

TVALue measures additional values such as db, Vs, etc.

TIMebase:POSition is position value of main time base; TIMebase:WINDow:POSition is position value of delayed time base window.

TRIGger:THReshold TRIGger:TV:TVMode

5-12

Programming and Documentation Conventions Obsolete and Discontinued Commands

Discontinued Commands Discontinued commands are commands that were used by previous oscilloscopes, but are not supported by the 5462x-series oscilloscopes. Listed below are the Discontinued commands and the nearest equivalent command available (if any). Discontinued Commands
Discontinued Command ASTore CHANnel:MATH DISPlay:INVerse DISPlay:COLumn DISPlay:GRID DISPLay:LINE DISPlay:PIXel DISPlay:POSition DISPlay:ROW DISPlay:TEXT FUNCtion:MOVE FUNCtion:PEAKs HARDcopy:ADDRess MASK MEASure:THResholds SYSTem:KEY TEST:ALL TRACE subsystem TRIGger:ADVanced subsystem TRIGger:TV:FIELd TRIGger:TV:TVHFrej TRIGger:TV:VIR VAUToscale TRIGger:TV:MODE none none none Current Command Equivalent DISPlay:PERSistence INFinite FUNCtion:OPERation none none none none none none none none none none none none none none *TST none All commands discontinued, feature not available Use new GLITch, PATTern or TV trigger modes Only parallel printer port is supported. GPIB printing not supported All commands discontinued, feature not availa