Page 1
Programmer’s Guide Publication number 54600-97017 July 1996 (pdf version Nov 1998) This guide contains programming information for the following oscilloscope models: HP 54600 HP 54601 HP 54602 HP 54603 HP 54610 HP 54615 HP 54616 For Safety information, Warranties, and Regulatory information, see the pages behind the Index.
Page 2
Programming the Oscilloscope When you attach an interface module to the rear of the HP 54600- Series Oscilloscopes, the oscilloscope becomes programmable. That is, you can hook a controller (such as a PC or workstation) to the oscilloscope, and write programs on that controller to automate oscilloscope setup and data capture.
Page 3
Capture Once you initialize the oscilloscope, you can begin capturing data for measurement. 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 is most likely invalid.
Page 4
Reference is supplied as a Microsoft Windows Help file on a 3.5" diskette. To program the HP 54600-Series Oscilloscope, you need an interface module, such as the HP 54650A or 54651A. 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.
Page 5
Introduction to Programming Programming Getting Started Programming over HP-IB Programming over RS-232-C Programming and Documentation Conventions Status Reporting Installing and Using the Programmer’s Reference Programmer’s Quick Reference Index...
Receiving Information from the Instrument 2–8 String Variables 2–9 Numeric Variables 2–10 Definite-Length Block Response Data 2–11 Multiple Queries 2–12 Instrument Status 2–12 3 Programming over HP-IB 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...
Page 8
Contents Minimum three-wire interface with software protocol 4–4 Extended interface with hardware handshake 4–5 Configuring the Interface 4–7 Interface Capabilities 4–8 Communicating over the RS-232-C bus 4–9 Lockout Command 4–10 5 Programming and Documentation Conventions Command Set Organization 5–3 The Command Tree 5–6 Truncation Rules 5–10 Infinity Representation 5–11 Sequential and Overlapped Commands 5–11...
Page 10
IEEE 488.2 Standard Digital Interface for Programmable Instrumentation. The programming instructions provide the means of remote control. To program the HP 54600-series oscilloscope you must add either an HP-IB (for example, HP 54650A) or RS-232-C (for example, HP 54651A) interface to the rear panel.
For example, HP BASIC uses the OUTPUT statement for sending commands and queries. After a query is sent, the response is usually read in using the ENTER statement.
Output Command The output command is entirely dependent on the programming language. Throughout this manual, HP BASIC 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 in order to convert the examples.
Page 13
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 <block data>, such as learnstring.
Page 14
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.
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 a semi-colon (;) is used to separate the functions: :<subsystem>:<function><separator><data>; <function><separator><data><terminator> (For example :CHANNEL1:COUPLING DC;BWLIMIT ON) Duplicate Mnemonics Identical function mnemonics can be used for more than one subsystem.
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.
Introduction to Programming Program Header Options Program Header Options Program headers can be sent 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.
Introduction to Programming Program Data Syntax Rules Program Data Syntax Rules Program data is used to convey a variety of types of parameter information related to the command header. At least one space must separate the command header or query header from the program data. <program mnemonic><separator><data><terminator>...
Introduction to Programming Program Data Syntax Rules All numbers are expected to 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).
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 HP-IB interface, or a combination of the two. Asserting the EOI sets the EOI control line low on the last byte of the data message.
Page 22
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 guide are written in HP BASIC, C, or SICL C. 2–2...
CLEAR 707 ! initializes the interface of the instrument When you are using HP-IB, 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"...
Programming Getting Started Autoscale Autoscale The AUTOSCALE feature performs a very useful function on unknown waveforms by setting up the vertical channel, time base, and trigger level of the instrument. The syntax for the autoscale function is: :AUTOSCALE<terminator> 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.
Programming Getting Started Example Program Example Program This program demonstrates the basic command structure used to program the oscilloscope. CLEAR 707 ! Initialize instrument interface OUTPUT 707;"*RST" ! Initialize inst to preset state OUTPUT 707;":TIMEBASE:RANGE 5E-4" ! Time base to 50 us/div OUTPUT 707;":TIMEBASE:DELAY 0"...
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.
Page 27
HP 54600-Series Oscilloscopes Programmer’s Reference. Aborting a Digitize Operation Over HP-IB When using HP-IB, a digitize operation may be aborted by sending a Device Clear over the bus (CLEAR 707). 2–7...
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 causes the output buffer to be cleared and the current response to be lost.
Refer to the specific commands for the formats and types of data returned from queries. Express String Variables Using Exact Syntax In HP BASIC, 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.
Programming Getting Started Numeric Variables Numeric Variables The following example shows the data being returned to a numeric variable: 10 OUTPUT 707;":CHANNEL1:RANGE?" 20 ENTER 707;Rang 30 PRINT Rang 40 END After running this program, the controller displays: 2–10...
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.
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.
Page 34
For more information on connecting the controller to the oscilloscope, see the documentation for the HP-IB interface card you are using. 3–2...
Programming over HP-IB 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: •...
Cursors • Each device on the HP-IB resides at a particular address, ranging from 0 to • The active controller specifies which devices talk and which listen. •...
For the oscilloscope, the instrument address is typically set to Oscilloscope Device Address The examples in this manual and in the online HP 54600-Series Oscilloscopes Programmer’s Reference assume the oscilloscope is at device address 707. See the documentation for your HP-IB interface card for more information on select codes and addresses.
Restore Front-Panel Control Cycling power also restores front panel control. With HP-IB, 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 command (GTL) to the instrument.
Page 40
Programming over RS-232-C This section describes the interface functions and some general concepts of the RS-232-C. 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.”...
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 the following sections.
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 since you can ignore hardware handshake requirements.
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): •...
Page 44
Programming over RS-232-C Extended interface with hardware handshake 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.
Programming over RS-232-C Configuring the Interface Configuring the Interface Set the baud rate and handshake protocol by using the front panel controls on the oscilloscope after the RS-232-C interface has been installed on the rear panel of the oscilloscope. 1 Press , then press the I/O Menu softkey.
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: •...
Each RS-232-C interface card has its own interface select code. This code is used by the controller to direct commands and communications to the proper interface. Unlike HP-IB, which allows multiple devices to be connected through a single interface card, RS-232-C is only connected between two devices at a time through the same interface card.
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.
Page 49
Programming and Documentation Conventions...
Page 50
This chapter covers conventions which are used in programming the instrument, as well as conventions used in the online HP 54600-Series Oscilloscopes Programmer’s Reference and the remainder of this manual. This chapter also contains a detailed description of the command tree and command tree traversal.
TRIGger controls the trigger modes and parameters for each trigger type. EXTernal Trigger defines the conditions for an external trigger. These commands only appear on the HP 54610, HP 54615, and HP 54616 Oscilloscopes. WAVeform provides access to waveform data.
MEASure *ESE Common PSTOp MEASure PWIDth MEASure These commands are used by the HP 54610, HP 54615, and HP 54616 only. These commands are used by the HP 54610 only. This command is used only by the HP 54616C. 5–4...
STATus Root level These commands are used by the HP 54610, HP 54615, and 54616 only. These commands are used by the HP 54610 only. These commands are used by all oscilloscope models except HP 54615 and HP 54616. 5–5...
Programming and Documentation Conventions The Command Tree The Command Tree The command tree shows all of the commands and the relationship of the commands to each other. The IEEE 488.2 common commands are not listed as part of the command tree since they do not affect the position of the parser within the tree.
Page 55
YINCrement PREShoot VMIN SLOPe YORigin PSTArt SOURce YREFerence PSTOp VPSTArt STANdard PWIDth VPSTOp TVHFrej RISetime VRMS TVMode * HP 54610/15/16 only SCRatch VSTArt SET100 VSTOp ** HP 54610 only SET360 VTIMe *** HP 54616C only SHOW VTOP SOURce 54600S13.CDR 5–7...
Page 56
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.
Page 57
Programming and Documentation Conventions The Command Tree Examples The OUTPUT statements in the examples are written using HP BASIC 5.0. 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"...
Programming and Documentation Conventions Truncation Rules Truncation Rules The truncation rule for the mnemonics used in headers and alpha arguments The mnemonic is the first four characters of the keyword unless: The fourth character is a vowel, then the mnemonic is the first three characters of the keyword.
Programming and Documentation Conventions Infinity Representation Infinity Representation The representation of infinity is 9.9E+37. This is also the value returned when a measurement cannot be made. Sequential and Overlapped Commands IEEE 488.2 distinguishes between sequential and overlapped commands. Sequential commands finish their task before the execution of the next command starts.
Programming and Documentation Conventions Notation Conventions and Definitions Notation Conventions and Definitions The following conventions and definitions are used in this manual and the online HP 54600-Series Oscilloscopes Programmer’s Reference in descriptions of remote operation: Conventions < > Angle brackets enclose words or characters that symbolize a program code parameter or an interface command.
Programming and Documentation Conventions Program Examples Program Examples The program examples given for commands in the online HP 54600-Series Oscilloscopes Programmer’s Reference were written using the HP BASIC for Windows, C, and SICL C programming languages. The programs always assume the oscillscope is at address 7 and the interface is at address 7 for a program address of 707.
Page 64
Status Reporting IEEE 488.2 defines data structures, commands, and common bit definitions for status reporting on the interface. There are also instrument-defined structures and bits. The bits in the status byte act as summary bits for the data structures residing behind them. In the case of queues, the summary bit is set if the queue is not empty.
Page 65
Status Reporting Figure 6–1 Status Reporting Data Structures 6–3...
Page 66
Status Reporting Bit Definitions MAV - message available. Indicates whether there is a response in the output queue. ESB - event status bit. Indicates if any of the conditions in the Standard Event Status Register are set and enabled. MSS - master summary status. Indicates whether the device has a reason for requesting service.
Page 67
Status Reporting Operation Complete (*OPC) The IEEE 488.2 structure provides one technique which can be used to find out if any operation is finished. The *OPC command, when sent to the instrument after the operation of interest, sets the OPC bit in the Standard Event Status Register when all pending device operations have finished.
01 on bus address 7. This command reads the contents of the HP-IB Status Register into the variable called Stat. At that time bit 6 of the variable Stat can be tested to see if it is set (bit 6=1).
Page 69
Status Reporting Serial Poll After the serial poll is completed, the RQS bit in the oscilloscope Status Byte Register is reset if it was set. Once a bit in the Status Byte Register is set, it remains set until the status is cleared with a *CLS command, or the instrument is reset.
Page 71
Installing and Using the Programmer’s Reference...
Page 72
Microsoft Windows 3.1 help viewer. A second diskette contains the help file as an ASCII text file and three sample programs for the HP 54600-Series Oscilloscopes. This chapter explains how to install the help file on your system, discusses the text and program files, and explains how you can get the programs and help file via the Internet.
IBM-compatible PC. The file uses the Microsoft Windows help viewer, WINHELP.EXE. Start your PC and start Microsoft Windows. Insert the 3.5" floppy disk labeled “HP 546XX Oscilloscopes Programmer’s Reference/Example Programs for Windows 3.1 Applications” into the appropriate diskette drive (A: or B:) of your PC.
The help file is available as an ASCII text file that can be browsed with a text editor or text search tools. Also, there are sample programs (in ASCII text format) that show how to use the HP 54600 commands with the oscilloscope. •...
Get sample programs or updated help files from the directory as desired. For example, if you want the latest version of the HP 54600-Series Oscilloscopes Programmer’s Reference online help file, you set the transfer mode to binary and get the file: ftp>...
To start the help file • To open the help file under Microsoft Windows, double-click the “Programmer’s Reference” icon in the “HP 54600-Series Oscilloscopes Programmer’s Reference” program group in the Program Manager. The help file requires the program WINHELP.EXE for Microsoft Windows 3.1.
Installing and Using the Programmer’s Reference To navigate through the help file To navigate through the help file • Navigate through the help file by clicking on highlighted text and buttons. See your Microsoft Windows documentation for more information, or select in the Help window.
Page 80
The Programmer’s Quick Reference provides the commands and queries with their corresponding arguments and returned formats for the HP 54600-Series Oscilloscopes. The arguments for each command list the minimum argument required. The part of the command or query listed in uppercase letters refers to the short form of that command or query.
G :: = 1E9 P :: = 1E-12 MA :: = 1E6 F :: = 1E-15 K :: = 1E3 A :: = 1E-18 For more information regarding specific commands or queries, please refer to the online HP 54600-Series Oscilloscopes Programmer’s Reference. 8–3...
Commands and Queries The following tables facilitate easy access to each command and query for the HP 54600-Series Oscilloscopes. The commands and queries are divided into separate categories with each entry alphabetized. The arguments for each command list the minimum argument required. The part of the command or query listed in uppercase letters refers to the short form of that command or query.
Page 83
{CHAN <n> | PMEM{1 | 2} | EXTernal} for the HP 54610 <n> ::= 1 or 2; an integer in NR1 format for the HP 54600/03/10/15/16 1, 2, 3, or 4; an integer in NR1 format for the HP 54601/02 :CHANnel<n>:BWLimit :CHANnel<n>:BWLimit?
Page 84
X1, X10, X20, X100 for the HP 54610/15/16 <n> ::= 1 or 2; an integer in NR1 format for HP 54600/03/10/15/16 1, 2, 3 or 4; an integer in NR1 format for the HP 54601/02 :CHANnel<n>:PROTect :CHANnel<n>:PROTect? {OFF | ON} {OFF | ON} <n>...
Page 85
<palette_number> ::= 0 through 6; an integer in NR1 format <palette_number> :DISPlay:PIXel :DISPlay:PIXel? <x>,<y> For HP 54616C: <x>, <y>, <intensity> <x> ::= x coordinate of the pixel to be set; an integer (0 to 500) in NR1 format <y> ::= y coordinate of the pixel to be set; an integer (0 to 275) in NR1 format <intensity>...
Page 86
<offset_argument> ::= offset value in volts in NR3 format <offset_argument> :EXTernal:PMODe :EXTernal:PMODe? {AUTo | MANual} {AUTo | MANual} :EXTernal:PROBe :EXTernal:PROBe? <attenuation> ::= {X1 | X10 | X20 | X100} for the HP 54610/15/16 <attenuation> :EXTernal:PROTect :EXTernal:PROTect? {OFF | ON} {OFF | ON} 8–8...
Page 87
Query Options and Query Returns :EXTernal:SETup? For the HP 54610: EXTernal:OFFSet <offset_value>; COUPling {DC | AC | GND}; PROBe {X1 | X10 | X20 | X100}; PMODe {AUTo | MANual}; INPut {FIFTy | ONEMeg}; PROTect {OFF | ON}; SKEW <skew_value>...
Page 88
Programmer’s Quick Reference Commands and Queries Command Query Options and Query Returns *IDN? HEWLETT-PACKARD,<model>, 0, X.X <model> ::= the model number of the instrument <X.X> ::= the software revision of the instrument *LRN? <learn_string> ::= a maximum of 218 bytes of data in IEEE 488.2 # format :MASK:CREATe :MASK:DATA :MASK:DATA?
Page 89
<n> ::= CHANnel <n> 1 or 2; an integer in NR1 format for HP 54600/03/10/15/16 1, 2, 3 or 4; an integer in NR1 format for the HP 54601/02 :MEASure:TDELta? <return_value> ::= time difference in seconds between start and stop...
Page 90
Programmer’s Quick Reference Commands and Queries Command Query Options and Query Returns :MEASure:UPPer :MEASure:UPPer? <voltage> ::= the user-defined upper threshold in volts in NR3 format <voltage> :MEASure:VAMPlitude :MEASure:VAMPlitude? <return_value> ::= the amplitude of the selected waveform in volts in NR3 format :MEASure:VAVerage? <return_value>...
Page 91
[enhancement] ::= [HIRes [,PCLColor]] HIRes ::= contains both half-bright and full-bright display information PCLColor ::= color DeskJet selection only on HP 54616C *RCL <value> ::= {1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 } <value>...
Page 92
<n> ::= 1 or 2; an integer in NR1 format for the HP 54600/03/10/15/16 1, 2, 3, or 4; an integer in NR1 format for the HP 54601/02 *STB? <value> ::= 0,...,255; an integer in NR1 format, as shown in the following:...
Page 93
<value> :TIMebase:RANGe :TIMebase:RANGe? <range_value> ::= the following values in NR3 format: <range_value> 50 ns through 50 s for HP 54603 20 ns through 50 s for HP 54600/01/02 10 ns through 50 s for HP 54610/15/16 :TIMebase:REFerence :TIMebase:REFerence? <return_value> ::= {LEFT | CENTer} for Normal or Delayed modes.
Page 94
<time> ::= holdoff time value in seconds in NR3 format <source> ::= {CHAN{1 | 2} | EXT | LINE} for HP 54600/03/10/15/16 {CHAN{1 | 2 | 3 | 4} | LINE} for HP 54601/02 <tvmode>::= {FIELD1 | FIELD2 | LINE} for HP 54600/01/03...
Page 95
{CHANnel <n> | PMEMory{1 | 2} | EXTernal} for the HP 54610 <n> ::= 1 or 2; an integer in NR1 format for the HP 54600/03/10/15/16 1, 2, 3, or 4; an integer in NR1 format for the HP 54601/02 *WAI :WAVeform:BYTeorder :WAVeform:BYTeorder? <value>...
Page 96
:WAVeform:SOURce? <n> ::= CHANnel <n> {1 | 2} for the HP 54600/03/10/15/16 {1 | 2 | 3 | 4} for the HP 54601/02 :WAVeform:TYPE? <return_mode> ::= {NORMal | PEAK | AVERage} :WAVeform:XINCrement? <return_value> ::= x-increment in the current preamble in NR3 format :WAVeform:XORigin? <return_value>...
Page 100
This Hewlett-Packard This is the first edition of the Hewlett-Packard edition and of any changed product has a warranty HP 54600-Series specifically disclaims the pages to that edition. against defects in material Oscilloscopes Programmer’s implied warranties of and workmanship for a period Guide.