HP 54620A, 54620C Programmer's Manual

Programmer’s Guide
Publication Number 54620-97012 October 1995 (pdf version Dec 1998)
For Safety information, Warranties, and Regulatory information, see the pages behind the Index.
© Copyright Hewlett-Packard Company 1994, 1995 All Rights Reserved
HP 54620A/C 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. Both HP-IB (also known as GP-IB, IEEE-488) and RS-232-C interfaces are available.
The following figure shows the basic structure of every program you will write for the analyzer.

Initialize

To ensure consistent, repeatable performance, you need to start the program, controller, and analyzer 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 logic analyzer.
Program initialization defines and initializes variables, allocates
memory, or tests system configuration. Controller initialization ensures that the interface to the analyzer
(either HP-IB or RS-232) is properly setup and ready for data transfer.
Analyzer initialization sets the channel configuration and labels,
threshold voltages, trigger specification and mode, timebase, and acquisition type.
2

Capture

Once you initialize the analyzer, you can begin capturing data for analysis. Remember that while the analyzer is responding to commands from the controller, it is not performing acquisitions. Also, when you change the analyzer configuration, any data already captured is most likely invalid.
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 analyzer, and the captured data can be measured, stored in trace memory in the analyzer, 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 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. :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 analyzer has completed an acquisition, you can find out more about the data, either by using the analyzer measurements or by transferring the data to the controller for manipulation by your program. Built-in measurements include frequency, duty cycle, period, positive and negative pulse width, channel-to-channel delay, and setup and hold time.
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.
3

In This Book

The
HP 54620A/C Programmer’s Guide
programming the HP 54620A or HP 54620C (color) Logic Analyzer using an instrument controller. This book, with the
Reference
programmatic interface. The 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.
This book contains the following information: Chapter 1, “Introduction to Programming,” gives a general overview of logic
analyzer programming. Chapter 2, “Programming Getting Started,” shows a simple program, explains
its operation, and discusses considerations for data types. Chapter 3, “Programming over HP-IB,” discusses the general considerations
for programming the instrument over an HP-IB 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 of the analyzer command set.
Chapter 6, “Status Reporting,” discusses the analyzer status registers and how to use them in your programs.
Chapter 7, “Installing and Using the Programmer’s Reference,” tells how to install the Microsoft Windows, and explains help file navigation.
Chapter 8, “Programmer’s Quick Reference,” lists all the commands and queries available for programming the logic analyzer.
For information on analyzer operation, see the For information on interface configuration, see the documentation for the analyzer interface module and the interface card used in your controller (for example, the HP 82341A interface for IBM PC-compatible computers).
, provides a comprehensive description of the analyzer’s
Programmer’s Reference
HP 54620A/C Programmer’s Reference
HP 54620A/C Programmer’s Reference
is your introduction to
HP 54620A/C Programmer’s
is supplied as a
, and gives an overview
online help file in
HP 54620A/C User’s Guide
.
4
Introduction to Programming
1
Programm ing Getting Started
2
Programm ing over HP-IB
3
Programm ing over RS-232-C
4
Programm ing and
5
Documentation Conventions
Status Reporting
6
Installing and Using the
7
Programm er’ s Reference
Programm er’ s Quick Referen ce
8
Index
5
6

Contents

1 Introduction to Programming
Talking to the instrument 11 Program message syntax 12 Combining commands from the same subsystem 15 Duplicate mnemonics 15 Query command 16 Program header options 17 Program data syntax rules 18 Program message terminator 20 Selecting multiple subsystems 20
2 Programming Getting Started
Initialization 23 Autoscale 24 Setting up the instrument 24 Example program 25 Program overview 27 Using the :DIGitize command 28 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
4 Programming over RS-232-C
Interface operation 43 Cables 43
7
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
7 Installing and Using the Programmer’s Reference
To install the help file under Microsoft Windows 71 To use the help text and example program files 72 To get updated help and program files via the Internet 73 To start the help file 74 To navigate through the help file 75
8 Programmer’s Quick Reference
Introduction 78
Conventions 79 Suffix multipliers 79 Commands and Queries 80
Index 89
8
1
Introduction to Programming
Introduction to Programming
Chapters 1 and 2 introduce the basics for remote programming of a logic analyzer. The programming instructions in this manual conform to the IEEE 488.2 Standard Digital Interface for Programmable 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.
You can perform the following basic operations with a controller and a logic analyzer:
Set up the instrument.
Make measurements.
Get data (waveform, measurements, configuration) from the logic
analyzer.
Send information (pixel image, configurations) to the logic
analyzer.
Other tasks are accomplished by combining these basic functions.
Languages fo r P rogram Examples
The programming exa m ples for individual commands in t his manual are written in HP BASIC or C.
10
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 logic analyzer.
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.
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 sets the threshold voltage for channels 0 through 7 to TTL:
OUTPUT < device address > ;
":LCH ANNEL: THRESHOLD LCHAN0_7,TTL"<terminat or>
The < device address > represents the address of the device being programmed. Each of the other parts of the above statement are explained in the “Program Message Syntax” which follows.
11
Figure 1
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. Figure 1 shows the main syntactical parts of a typical program statement.
Program Message Syntax

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. For example, the example progam in chapter 2 is written in C, and uses the library function IOOUTPUTS to send a command. The instructions listed in this manual are always enclosed in quotation marks in the example programs.

Device Address

The location where the device address must be specified also depends 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 logic analyzer is at device address 707. When writing programs, the address varies according to how the bus is configured.
12
Introduction to Programming
Program me ss age 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>. There are only a few instructions that use block data. See the :WAVeform:DATA? query for an example of a command that uses block data.
Instructions are composed of two main parts:
The header, which specifies the command or query to be sent.
The program data, which provides additional information needed to clarify
the meaning of the instruction.

Instruction Header

The instruction header represents the operation to be performed by the instrument, and is one or more mnemonics separated by colons (:). 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 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 spaces. 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 “Program Data Syntax Rules” topic in this chapter describes all of the general rules about acceptable values.
13
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
Compound command headers
Common command headers
Simple command header
mnemonic. :AUToscale and :DIGitize are examples of simple command headers typically used in this instrument. The syntax is:
<prog ram mnem onic><terminator>
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, :BLANk LCHan0), white space is added to separate the data from the header. The syntax is:
<program mnemonic><separator><program data><terminator>
Compound command header
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:
:<subsystem>:<function><separator><program data><terminator>
(For example :DISPlay:TEXT BLANk)
Common command header
488.2 functions within the instrument (such as clear status). Their syntax is:
*<comm an d he ad er><term in at or>
No space or separator is allowed between the asterisk (*) and the command header. *CLS is an example of a common command header.
Simple command headers contain a single
Compound command headers are a
Common command headers control IEEE
14
Introduction to Programming

Combining co m m ands from the same s ubsystem

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. For example, the function mnemonic DELAY may be used to set the trigger delay or measure channel-to-channel delay:
:TIMEBASE:DELAY 30 US
sets the trigger delay to 30 µs.
:MEASURE:DELAY
measures the delay betwen predefined start and end channels (see :MEASure:DEFine:DELay).
:TIMebase and :MEASure are subsystem selectors and determine which meaning of DELAY is used.
15
Introduction to Programming

Query comm and

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:PERiod? instructs the instrument to measure the period of the current measurement source channel 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: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.
Read the Query Result First
Sending another command or query before reading the result of a query causes the output buffer to be cleared and the current resp onse to be lost. This also generates a query interrupted error in the error q ueue.
16
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. For example:
TIMEBASE:DELAY 1US - long form TIM:DEL 1US - short form
Programs written in long form are easy to read and are almost self-documenting. The short form syntax conserves the amount of controller memory needed for program storage and reduces the amount of I/O activity.
Command Syn tax Programming Rules
The rules for the s hort form syntax are described in chapter 5, “Programming and Documentation Conventio ns.”
17
Introduction to Programming

Program data s yntax 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.
<prog ram mnem onic><separator><data><termina tor>
When a program mnemonic or query has multiple program data, a comma separates sequential program data.
<prog ram mnem onic><separator><data>,<data>< terminator>
For example, :DISPlay:PIXel 10,12,2 has three program data: 10, 12, and 2. There are two main types of program data used in commands: character and
numeric program data.

Character Program Data

Character program data conveys parameter information as alpha or alphanumeric strings. For example, the :TIMebase:MODE command can be set to normal or delayed. The character program data in this case may be NORMal or DELayed. 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. When sending commands, either the long form or short form (if one exists) may be used. 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, it means that the number should be whole. Any fractional part would be ignored, truncating the number. Numeric data parameters that accept fractional values are called real numbers.
18
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). This is taken care of 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 logic analyzer. For example, this line of text written to the advisory line of the instrument with the :SYSTem:DSP command is an embedded string:
:SYSTEM:DSP"This is a message."
Embedded strings may be delimited with either single (’) or double (") quotation marks. These strings are case-sensitive, and spaces act as legal characters—just like any other character.
19
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 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. The NL character is an ASCII linefeed (decimal 10).
New Line Termi nator Functions
The NL (New Line) terminator has the same functi on as an EOS (End O f String) and EOT (End O f Text) terminator.

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:
<prog ram mnem onic><data>; :<program mnemonic><data><terminator>
:TRIGGER:MODE NORMAL;:TIMEBASE:RANGE 1
Combining Compound and Simple C om m ands
Multiple com m ands may be any combination of co m pound and simple commands.
20
2
Programming Getting Started
Programming Getting Started
This chapter explains how to:
Set up the instrument
Retrieve setup information and measurement results
Digitize a waveform
Pass data to the controller
Languages fo r P rogram Examples The programming exa mples in this manual are written in HP BASIC or C.
22
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 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" ! initializes the instrument to a preset state.
Information for Initializing the Ins trument
The actual commands and syntax for initializing the instrument are discussed in the online
HP 54620A/C Programmer’s Reference
.
Refer to your contr oller manual and programming language reference ma nual for information about initializing the interface.
23
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. An example of the commands sent to the logic analyzer is as follows:
:LCHAN NE L: TH RESHOLD LC HA N0 _7, TTL<te rm in at or> :LCHANNEL:THRESHOLD LCHAN8_15, ECL<terminator> :BLAN K LCHANN EL7<terminator> :BLAN K LCHANN EL12<terminator> :BLAN K LCHANN EL13<terminator> :TIMEBASE:RANGE 100US;REFERENCE CENTER;DELAY 1.5US<terminator> :TRIGG ER :T YP E EDGE;EDG E LC HA NNEL3,FA LL IN G< terminat or > :TRIGG ER :M OD E NORMAL<t er mi nator>
This example sets channels 0 through 7 to TTL thresholds, sets channels 8 through 15 to CMOS thresholds, and turns off channels 7, 12, and 13 (the :BLANk command). It sets the sweep speed to 100 µs/div, with time reference at center and positive delay of 1.5 µs. Finally, it sets the trigger mode to normal with an edge trigger on the falling edge of channel 3.
24
Programming Getting Started

Example pr ogram

Example program
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> /* Include file for malloc, etc */ #include "CHPIB.H" /* HPIB Library constant declarations */ #include "CFUNC.H" /* HPIB library function prototypes */
/* Globals used throughout the program */ long isc; long an alyzer ; int error;
/* errorhandle - This function prints an error message of the screen */ /* regarding the command that caused the error. */ void errorhandle( char *function, char *cmdcause ) { if ( error != NOERR ) { printf("HPIB error in call to %s with %s, error = %s\n", function, cmdcause, errstr(error) ); exit(1); } }
/* sendstringcmd - this function interfaces to the actual hpib output */ /* functions. It also checks for errors and calls the */ /* errorhandler function above */ void sendstringcmd( char *cmd) { error = IOOUTPUTS( analyzer, cmd, strlen(cmd) ); errorhandle("IOOUTPUTS", cmd); }
int main () { isc = 7; /* Assign 7 to isc global */ analyzer = 707; /* Assign device address (707) to analyzer */ error = IORESET ( isc ); /* Reset the isc */
25
Programming Getting Started
Example prog ram
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"); /* RESET the instrument */
/* set trigger mode to NORMAL */ sendstringcmd ( ":TRIGGER:MODE NORMAL");
/* set trigger type to Simple edge */ sendstringcmd ( ":TRIGGER:TYPE EDGE" );
/* set trigger to rising edge on channel 0 */ sendstringcmd (":TRIGGER:EDGE LCHANNEL0, RISING");
/* set thresholds, time base and delay */ sendstringcmd (":autoscale");
return 0; } /* end main */
26
Programming Getting Started

Program overview

Program overview
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
isc
code ( The
), analyzer address (
errorhandle()
function takes two strings defining the program function and analyzer command string. If the global non-zero, it prints (to the controller screen) an error message that includes this information. It then forces the program to exit.
sendstringcmd()
The
function encapsulates data tranmission to the
instrument with error handling. First it calls the HP-IB library function
IOOUTPUTS
to send the specified command string (passed through the analyzer. The result of the variable, so the
errorhandle
occurred). The
main()
function initializes the interface select code and analyzer
address variables. It then calls HP-IB library functions
IOCLEAR
and Then the
to initialize the HP-IB card (and check for proper initialization).
sendstringcmd
analyzer, set the trigger mode to normal, define an edge trigger on the rising edge of channel 0, and invoke the autoscale feature.
analyzer
IOOUTPUTS
), and error handling.
error
variable is
call is returned to the error
cmd
function is called to process the error (if one
IORESET, IOTIMEOUT
function is called several times to reset the
) to
,
27
Programming Getting Started

Using the :DIGitize command

Using the :DIGitize command
The :DIGitize command captures data that satisfyies the specifications set up during analyzer configuration. 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 D ata is Collected
After changing the logic analy z er configuration , the waveform buffe rs are cleared. Bef ore running a measurement, send the DIGITIZE command to the analyzer to e nsure new data has been collected.
When you send the :DIGitize command to the analyzer, the input to all analyzer channels is captured and put into acquisition memory based on the current time base and threshold settings and trigger specification. To transfer the acquired waveform data to the controller, you must specify the :WAVeform parameters for the waveform data prior to sending the :WAVeform:DATA? query.
Set :TIMebase: MODE to NORM al when Using :DI Gitize
:TIMebase: MODE must be set t o NORMal to perform a :DIGitize o r a W AVeform subsystem query. A "S et tings conflict" error mes sa ge will be returned if these commands are executed when MO DE is set to DEL ayed. Sending the *RST (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 help file for more information.
28
HP 54620A/C Programmer’s Reference
online
Loading...
+ 64 hidden pages