Page 2
Programming the Logic Analyzer When you attach an interface module to the rear of the HP 54620A or HP 54620C (color) Logic Analyzer, the analyzer becomes programmable. That is, you can hook a controller (such as a PC or workstation) to the analyzer, and write programs on that controller to automate analyzer setup and data capture.
Page 3
You could also start the analyzer running, then use a wait loop in your program to ensure that the analyzer 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.
Page 4
The Programmer’s Reference is supplied as a Microsoft Windows Help file on a 3.5" diskette. To program the HP 54620A/C, you need an interface module, such as the HP 54650A, 54651A, or 54652B. 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 30 String variables 31 Numeric variables 32 Definite-length block response data 33 Multiple queries 34 Instrument status 34 3 Programming over HP-IB Interface capabilities 37 Addressing 37 Communicating over the bus 38 Lockout 39 Bus commands 39...
Page 8
Contents Configuring the interface 46 Interface capabilities 46 Lockout Command 47 5 Programming and Documentation Conventions Command Set Organization 51 The command tree 52 Truncation rules 56 Infinity representation 57 Sequential and overlapped commands 57 Response generation 57 Notation conventions and definitions 58 Program Examples 59 6 Status Reporting Serial poll 66...
Page 10
Instrumentation. The programming instructions provide the means of remote control. To program the HP 54620A Logic Analyzer or HP 54620C (color) Logic Analyzer, you must add either an HP-IB (for example, HP 54650A) or RS-232-C (for example, HP 54651A or HP 54652B) 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 of the individual command exampless. If you are using other languages, you must find the equivalents of HP BASIC commands like OUTPUT, ENTER, and CLEAR to convert the examples.
Page 13
Introduction to Programming Program message syntax Instructions Each instruction (for both commands and queries) normally appears 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>.
Page 14
Introduction to Programming Program message syntax When there are more than one data parameter, they are separated by commas (,). Spaces can be added around the commas to improve readability. Header Types There are three types of headers: • Simple command headers •...
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 :TIMebase:REFerence LEFT;VERNier 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:PERiod? 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 conveys 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>...
Page 19
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 • Retrieve setup information and measurement results • Digitize a waveform • Pass data to the controller Languages for Program Examples The programming examples in this manual are written in HP BASIC or C.
CLEAR 707 ! initializes the interface of the instrument When you are using HP-IB, CLEAR also resets the logic analyzer’s parser. The parser is the program that reads in the instructions you send to 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 instrument logic thresholds, initial channel settings, and time base. The syntax for the autoscale function is: :AUTOSCALE<terminator> Setting up the instrument A typical logic analyzer setup would set the threshold voltages, turn on the appropriate channels, and set up the sweep speed, delay time, trigger mode, trigger type, and trigger specification.
This C program demonstrates the basic command structure used to program the logic analyzer, and how that command structure is embedded into the C language. /*HP Instrument C program using the HP-IB interface #include <stdio.h> /* Include file for printf, etc */ #include <stdlib.h>...
Page 26
Programming Getting Started Example program errorhandle( "IORESET"); /* Report any problems */ error = IOTIMEOUT (isc, 5.0); /* 5 second timeout errorhandle( "IOTIMEOUT"); /* Report any problems */ error = IOCLEAR (isc); /* Clear the isc */ errorhandle( "IOCLEAR"); /* Report any problems */ sendstringcmd("*RST");...
The first few lines of the program include header files that define function prototypes for standard C libraries and specialized libraries that handle the HP-IB interface. The program then defines variables for the interface select code ( ), analyzer address ( ), and error handling.
(reset) command will also set the time base mode to normal. The number of data points comprising a waveform is either 2048 or 8192, depending on whether the analyzer is in glitch mode. See the :ACQuire subsystem information in the HP 54620A/C Programmer’s Reference online help file for more information.
Page 29
(the :ACQuire:TYPE command). The easiest method of transferring a digitized waveform depends on data structures, formatting available, and I/O capabilities. For more information, see the waveform subsystem commands and corresponding program code examples in the online HP 54620A/C Programmer’s Reference.
Programming Getting Started Receiving information from the instrument 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). 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.
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;":TIMEBASE:RANGE?" 20 ENTER 707;Rang 30 PRINT Rang 40 END If the time base is set to 1 s/div, the controller displays:...
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 in a single program message. When sending multiple queries in this way, you must then read them back in a single program message. You can do this by either reading them back into a string variable or into multiple numeric variables.
“Connect to Computer” mode. Figure 2 is the Print/Utility menu after the HP 54650A HP-IB interface has been installed on the rear panel of the logic analyzer. Use this menu to set the HP-IB address for the logic analyzer and “Connect to Computer.”...
704. Logic Analyzer Device Address The examples in this manual and in the online HP 54620A/C Programmer’s Reference assume the logic analyzer is at device address 707. See the documentation for your HP-IB interface card for more information...
The :SYSTem:LOCK OFF command will 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 42
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 logic analyzer 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.
Page 44
Programming over RS-232-C Cables because you can ignore hardware handshake requirements. The logic analyzer 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 logic analyzer) •...
Page 45
Programming over RS-232-C Cables • Pin 5 CTS (Clear To Send) is an input to the logic analyzer which controls data flow from the logic analyzer. • Pin 6 DSR (Data Set Ready) is an input to the logic analyzer which controls data flow from the logic analyzer within two bytes.
Print/Utility menu after the RS-232-C interface module has been installed on the rear panel. Use this menu to “Connect to Computer,” and assign the baud rate and handshake protocol. The HP 54652B module has a slightly different set of menus.
Programming over RS-232-C Lockout Command 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 logic analyzer) controls data flow and can request that the sender (logic analyzer or controller) stop data flow.
Page 49
Programming and Documentation Conventions...
Page 50
Conventions This chapter describes conventions used in programming the instrument, as well as conventions used in the online HP 54620A/C Programmer’s Reference and the remainder of this manual. This chapter also contains a detailed description of the command tree and...
ACQuire—sets the parameters for acquiring and storing data. • DISPlay—controls how waveforms, the graticule, and text are displayed and written on the screen, including the color palette for the HP 54620C (color) logic analyzer. • LCHannel—controls all logic analyzer functions associated with individual channels or groups of channels, including channel color for the HP 54620C (color) logic analyzer.
Programming and Documentation Conventions The command tree The command tree The following command tree shows all of the logic analyzer commands and their relationships 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.
Page 53
Programming and Documentation Conventions The command tree...
Page 54
(for example, DELay) without sending the mnemonics that appear above them. Examples The OUTPUT statements in the examples are written using HP BASIC. The quoted string is placed on the bus, followed by a carriage return and linefeed (CRLF).
Page 55
Programming and Documentation Conventions The command tree Example 2: OUTPUT 707;":TIMEBASE:REFERENCE CENTER ; DELAY 0.00001" OUTPUT 707;":TIMEBASE:REFERENCE CENTER" OUTPUT 707;":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 because the program message terminator places the parser back at the root of the command tree.
Programming and Documentation Conventions Truncation rules Truncation rules These are the truncation rules for mnemonics used in headers and alpha arguments: The mnemonic is the first four characters of the keyword. the fourth character is a vowel, then the mnemonic is the first three characters of the keyword. This rule is not applied if the length of the keyword is exactly four characters.
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 next command begins to execute.
Notation conventions and definitions Notation conventions and definitions The following conventions and definitions are used in this manual and the online HP 54620A/C 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 for commands in the online HP 54620A/C Programmer’s Reference were written using the HP BASIC programming language. The programs always assume the logic analyzer is at address 7 and the interface is at address 7 for a program address of 707.
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. Bits in the status byte act as summary bits for data structures that reside behind them. •...
Page 63
Status Reporting Figure 4 Status Reporting Data Structures...
Page 64
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 65
Status Reporting Operation complete (*OPC) The IEEE 488.2 structure provides one technique that you can use to determine whether 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 67
Status Reporting Serial poll The SPOLL(707) command causes much more activity on the bus than simply reading the register. This command: • Clears the bus • Automatically addresses the talker and listener • Sends SPE (serial poll enable) and SPD (serial poll disable) bus commands •...
Installing and Using the Programmer’s Reference...
Page 70
Installing and Using the Programmer’s Reference The HP 54620A/C Programmer’s Reference is supplied as an online help file readable with the 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 54620A/C.
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 54620 Pgmr’s Reference with 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 54620A/C commands with the analyzer. •...
Get sample programs or updated help files from the directory as desired. For example, if you want the latest version of the HP 54620A/C 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 “HP 54620 Help” icon in the “HP 54620 Prog Ref” 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.
The Programmer’s Quick Reference provides the commands and queries with their corresponding arguments and returned formats for the HP 54620A/C Logic Analyzer. 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 54620A/C Programmer’s Reference.
Commands and Queries The following tables facilitate easy access to each command and query for the HP 54620A/C Logic Analyzer. The commands and queries are broken 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 81
:DISPlay:PALette <arg> (HP 54620C only) :DISPlay:PALette? <arg> ::= 16-bit integer in NR1 format <arg> ::= 16-bit integer in NR1 format This command is used by the HP 54620C. These values match the front-panel order: 0 Default 1 Alternate 1 2 Alternate 2...
Page 82
*ESR? <status> <new line> <status> ::= 16-bit integer in NR1 format *IDN? HEWLETT-PACKARD, <instrument>, 0, <X.XX.XX> <new line> <instrument> ::= 54620A or 54620C (color logic analyzer) <X.XX.XX> ::= the software revision number string, for example, A.01.00 :LCHannel:ACTivity :LCHannel:ACTivity? <edges>, <levels> <newline>...
Page 92
This Hewlett-Packard This is the first edition of the Hewlett-Packard edition and of any changed product has a warranty HP 54620A/C Logic specifically disclaims the pages to that edition. against defects in material Analyzer Programmer’s implied warranties of and workmanship for a period Guide.