Hewlett-Packard 16500C, 16501A User Manual

Programmer’s Guide
Publication number 16500-97018 First edition, December 1996
For Safety information, Warranties, and Regulatory information, see the pages behind the Index
Copyright Hewlett-Packard Company 1987, 1990, 1993, 1994, 1996 All Rights Reserved
HP 16500C/16501A Logic Analysis System
ii

In This Book

This programmer’s guide contains general information, mainframe level commands, and programming examples for programming the HP 16500C/16501A Logic Analysis System. This guide focuses on how to program the system over the HP-IB interface, but also briefly explains how to use the RS-232-C and LAN interfaces. The Logic Analysis System cannot be programmed over the 16505 interface.
This guide provides a complete set of programming information for your system.
Introduction to Programming
1
Programming Over HP-IB
2
Programming Over RS-232-C
3
Programming Over LAN
4
Programming and
5
Documentation Conventions
Message Communication
6
and System Functions
Status Reporting
7
Organization
When you received your HP 16500C Programmer’s Guide you received two binders, Volume 1 and Volume 2. The Volume 2 binder gives you a place to insert the module programmer’s guides when the Volume 1 binder is full.
As you purchase additional measurement modules, insert their programmer’s guides in the back of this binder or in the second binder.
What is in the HP 16500C/16500A Programmer’s Guide?
The HP 16500C/16501A Programmer’s Guide is organized in three parts.
8
9
10
11
12
13
14
15
Error Messages
Common Commands
Mainframe Commands
SYSTem Subsystem
MMEMory Subsystem
INTermodule Subsystem
TGTctrl Subsystem
Programming Examples
iii
Part 1 Part 1 consists of chapters 1 through 8 and contains general information about programming basics, HP-IB, RS-232-C, and LAN interface requirements, documentation conventions, status reporting, and error messages. If you are already familiar with IEEE 488.2 programming and HP-IB or RS-232-C, you may want to just scan these chapters. If you are new to programming logic analyzers you should read part 1.
Chapter 1 is divided into two sections. The first section, "Talking to the Instrument," concentrates on program syntax, and the second section, "Receiving Information from the Instrument," discusses how to send queries and how to retrieve query results from the instrument.
Read either chapter 2, "Programming Over HP-IB," chapter 3, "Programming Over RS-232-C," or chapter 4, "Programming over LAN" for information concerning the physical connection between the HP 16500C/16501A Logic Analysis System and your controller.
Chapter 5, "Programming and Documentation Conventions," gives an overview of all instructions and also explains the notation conventions used in the syntax definitions and examples.
Chapter 6, "Message Communication and System Functions," provides an overview of the operation of instruments that operate in compliance with the IEEE 488.2 standard.
Chapter 7 explains status reporting and how it can be used to monitor the flow of your programs and measurement process.
Chapter 8 contains error message descriptions. Part 2 Part 2, chapters 9 through 14, explain each command in the
command set for the mainframe. These chapters are organized in subsystems with each subsystem representing a menu.
The commands explained in this part give you access to common commands, mainframe commands, system level commands, disk commands, intermodule measurement, and target control commands. This part is designed to provide a concise description of each command.
Part 3 Part 3, chapter 15, contains program examples of actual tasks that show you how to get started in programming the HP 16500C/ 16501A Logic Analysis System at the mainframe level. The complexity of your programs and the tasks they accomplish are limited only by your imagination. These examples are written in HP BASIC 6.2; however, the program concepts can be used in any other popular programming language that allows communications over HP-IB, RS-232-C, or LAN.
iv

Contents

Part 1 General Information
1 Introduction to Programming
Introduction 1–2
Talking to the Logic Analysis System 1–3
Talking to Individual System Modules 1–4 Initialization 1–4 Instruction Syntax 1–6 Output Command 1–6 Device Address 1–7 Instructions 1–7 Instruction Terminator 1–8 Header Types 1–9 Duplicate Keywords 1–10 Query Usage 1–11 Program Header Options 1–12 Parameter Data Types 1–13 Selecting Multiple Subsystems 1–15
Receiving Information from the Logic Analysis System 1–16
Response Header Options 1–17 Response Data Formats 1–18 String Variables 1–19 Numeric Base 1–20 Numeric Variables 1–20 Definite-Length Block Response Data 1–21 Multiple Queries 1–22 System Status 1–23
Contents–1
Contents
2 Programming Over HP-IB
Interface Capabilities 2–3 Command and Data Concepts 2–3 Talk/Listen Addressing 2–3 HP-IB Bus Addressing 2–4 Local, Remote, and Local Lockout 2–5 Bus Commands 2–6
3 Programming Over RS-232-C
Interface Operation 3–3 RS-232-C Cables 3–3 Minimum Three-Wire Interface with Software Protocol 3–4 Extended Interface with Hardware Handshake 3–5 Cable Examples 3–6 Configuring the Logic Analysis System Interface 3–7 Interface Capabilities 3–8 RS-232-C Bus Addressing 3–9 Lockout Command 3–10
4 Programming Over LAN
Communicating with the HP 16500C 4–3 LAN Addressing 4–3 Password Protection and File Protection 4–4 Permission Levels: Control and Data 4–4 Controlling the HP 16500C 4–5 Echoing Commands 4–6 Copying Command Files 4–7 Writing to \system\program from a Program 4–8 Sending Commands to the HP 16500C Socket 4–11 Lockout Command 4–13
Contents–2
5 Programming and Documentation Conventions
Truncation Rule 5–3 Infinity Representation 5–4 Sequential and Overlapped Commands 5–4 Response Generation 5–4 Syntax Diagrams 5–4 Notation Conventions and Definitions 5–5 The Command Tree 5–6 Tree Traversal Rules 5–8 Command Set Organization 5–10 Subsystems 5–10 Program Examples 5–12
6 Message Communication and System Functions
Contents
Protocols 6–3 Syntax Diagrams 6–5 Syntax Overview 6–7
7 Status Reporting
Event Status Register 7–4 Service Request Enable Register 7–4 Bit Definitions 7–4 Key Features 7–6 Serial Poll 7–8 Parallel Poll 7–9 Polling HP-IB Devices 7–11 Configuring Parallel Poll Responses 7–11 Conducting a Parallel Poll 7–12 Disabling Parallel Poll Responses 7–13 HP-IB Commands 7–13
Contents–3
Contents
8 Error Messages
Device Dependent Errors 8–3 Command Errors 8–3 Execution Errors 8–4 Internal Errors 8–4 Query Errors 8–5
Part 2 Commands
9 Common Commands
*CLS (Clear Status) 9–5 *ESE (Event Status Enable) 9–6 *ESR (Event Status Register) 9–7 *IDN (Identification Number) 9–9 *IST (Individual Status) 9–9 *OPC (Operation Complete) 9–11 *OPT (Option Identification) 9–12 *PRE (Parallel Poll Enable Register Enable) 9–13 *RST (Reset) 9–14 *SRE (Service Request Enable) 9–15 *STB (Status Byte) 9–16 *TRG (Trigger) 9–17 *TST (Test) 9–18 *WAI (Wait) 9–19
10 Mainframe Commands
BEEPer 10–6 CAPability 10–7 CARDcage 10–8 CESE (Combined Event Status Enable) 10–10 CESR (Combined Event Status Register) 10–11 EOI (End Or Identify) 10–13 LER (LCL Event Register) 10–13 LOCKout 10–14 MENU 10–15
Contents–4
MESE<N> (Module Event Status Enable) 10–16 MESR<N> (Module Event Status Register) 10–18 RMODe 10–19 RTC (Real-time Clock) 10–20 SELect 10–21 SETColor 10–23 STARt 10–24 STOP 10–25 XWINdow 10–26
11 SYSTem Subsystem
DATA 11–5 DSP (Display) 11–6 ERRor 11–7 HEADer 11–8 LONGform 11–9 PRINt 11–10 SETup 11–12
Contents
12 MMEMory Subsystem
AUToload 12–7 CATalog 12–8 CD (Change Directory) 12–9 COPY 12–10 DOWNload 12–11 IDENtify 12–13 INITialize 12–14 LOAD[:CONFig] 12–15 LOAD :IASSembler 12–16 MKDir (Make Directory) 12–17 MSI (Mass Storage Is) 12–18 PACK 12–19 PURGe 12–20 PWD (Present Working Directory) 12–21
Contents–5
Contents
REName 12–22 STORe [:CONFig] 12–23 UPLoad 12–24 VOLume 12–25
13 INTermodule Subsystem
:INTermodule 13–5 DELete 13–6 HTIMe 13–7 INPort 13–8 INSert 13–9 OUTDrive 13–10 OUTPolar 13–10 OUTType 13–11 PORTEDGE 13–12 PORTLEV 13–13 SKEW<N> 13–14 TREE 13–15 TTIMe 13–17
14 TGTctrl Subsystem
:TGTctrl 14–5 ALL 14–6 AVAILable 14–7 BITS 14–8 CURSTate 14–9 DRIVe 14–9 LASTstate 14–10 NAMe 14–11 PULse 14–12 SIGNal 14–12 SIGSTatus 14–13 STATEs 14–14 STEP 14–15 TOGgle 14–15 TYPe 14–16
Contents–6
Part 3 Programming Examples
15 Programming Examples
Transferring the Mainframe Configuration 15–3 Checking for Intermodule Measurement Completion 15–6 Sending Queries to the Logic Analysis System 15–7 Getting ASCII Data with PRINt? ALL Query 15–9 Reading the disk with the CATalog? ALL query 15–10 Reading the Disk with the CATalog? Query 15–11 Printing to the disk 15–12
Index
Contents
Contents–7
Contents–8
Part 1
1 Introduction to Programming 1-1 2 Programming Over HP-IB 2-1 3 Programming Over RS-232-C 3-1 4 Programming Over LAN 4-1 5 Programming and Documentation Conventions 5-1 6 Message Communication and System Functions 6-1 7 Status Reporting 7-1 8 Error Messages 8-1

General Information

1

Introduction to Programming

Introduction
This chapter introduces you to the basics of remote programming and is organized in two sections. The first section, "Talking to the Logic Analysis System," concentrates on initializing the bus, program syntax and the elements of instruction syntax. The second section, "Receiving Information from the Logic Analysis System," discusses how queries are sent and how to retrieve query results from the system.
The programming instructions explained in this book conform to IEEE Std 488.2-1987, "IEEE Standard Codes, Formats, Protocols, and Common Commands." These programming instructions provide a means of remotely controlling the HP 16500C Logic Analysis System. There are three general categories of use. You can:
Set up the system and start measurements
Retrieve setup information and measurement results from the
measurement modules
Send measurement data to the measurement modules
The instructions listed in this manual give you access to the functions of the mainframe. This programming reference is designed to provide a concise description of each instruction for the mainframe. Individual module instruction descriptions are in the Programmer’s Guide for each respective module.
1–2

Talking to the Logic Analysis System

In general, computers acting as controllers communicate with the instrument by sending and receiving messages over a remote interface, such as HP-IB, RS-232-C, or Ethernet LAN.
When programming the HP 16500C with the HP 16501A Expansion Frame connected, most of the remote operation of the expansion frame is transparent. The only time a programming command is affected by the presence of the expansion frame is when the number of slots is specified or returned from a query.
Instructions for programming the system will normally appear as ASCII character strings embedded inside the output statements of a "host" language available on your controller. The host language’s input statements are used to read in responses from the system. For example, HP 9000 Series 300 BASIC uses the OUTPUT statement for sending commands and queries to the system. After a query is sent, the response can be read in using the ENTER statement. All programming examples in this manual are presented in HP BASIC.
Example This BASIC statement sends a command that causes the logic analyzer’s
machine 1 to be a state analyzer:
OUTPUT XXX;":MACHINE1:TYPE STATE" <terminator>
Each part of the above statement is explained in this section.
1–3
Introduction to Programming
Talking to Individual System Modules
Talking to Individual System Modules
Talking to individual system modules within the HP 16500C Logic Analysis System is done by preceding the module commands with the SELECT command and the number of the slot in which the desired module is installed. The mainframe is selected in the same way as an installed module by using the SELECT 0 command.
Example To select the module in slot 3 use the following:
OUTPUT XXX;":SELECT 3"
See Also Chapter 10, "Mainframe Commands" for more information on the SELECT
command.
Initialization
To make sure the bus and all appropriate interfaces are in a known state, begin every program with an initialization statement. BASIC provides a CLEAR command that clears the interface buffer. If you are using HP-IB, CLEAR will also reset the parser in the Logic Analysis System. The parser is the program resident in the Logic Analysis System that reads the instructions you send to it from the controller.
After clearing the interface, you could, for example, preset the logic analyzer module to a known state by loading a predefined configuration file from the disk.
Refer to your controller manual and programming language reference manual for information on initializing the interface.
1–4
Introduction to Programming
Initialization
Example This BASIC statement would load the configuration file "DEFAULT " (if it
exists) into the system.
OUTPUT XXX;":MMEMORY:LOAD:CONFIG ’DEFAULT ’"
Example This program demonstrates a simple HP BASIC command structure used to
program the Logic Analysis System.
10 CLEAR XXX !Initialize instrument interface 20 OUTPUT XXX;":SYSTEM:HEADER ON" !Turn headers on 30 OUTPUT XXX;":SYSTEM:LONGFORM ON" !Turn long form on 40 DIM Card$[100] !Reserve memory for string variable 50 OUTPUT XXX;":CARDCAGE?" !Verify which modules are loaded 60 ENTER XXX;Card$ !Enter result in a string variable 70 PRINT Card$ !Print result of query 80 OUTPUT XXX;":MMEM:LOAD:CONFIG ’TEST._E’,5" !Load configuration file !into module in slot E 90 OUTPUT XXX;":SELECT 5" !Select module in slot E 100 OUTPUT XXX;":MENU 5,3: !Select menu for module in slot E 110 OUTPUT XXX;":RMODE SINGLE" !Select run mode 120 OUTPUT XXX;":START" !Run the measurement
See Also Chapter 12, "MMEMory Subsystem" for more information on the LOAD
command.
1–5
Figure 1-1
Introduction to Programming
Instruction Syntax
Instruction Syntax
To program the system remotely, you must have an understanding of the command format and structure. The IEEE 488.2 standard governs syntax rules pertaining to how individual elements, such as headers, separators, parameters and terminators, may be grouped together to form complete instructions. Syntax definitions are also given to show how query responses will be formatted. Figure 1-1 shows the three main syntactical parts of a typical program statement: Output Command, Device Address, and Instruction. The instruction is further broken down into three parts: Instruction header, White space, and Instruction parameters.
Program Message Syntax
Output Command
The output command depends on the language you choose to use. Throughout this guide, HP 9000 Series 300 BASIC 6.2 is used in the programming examples, except where noted. If you use another language, you will need to find the equivalents of BASIC Commands, like OUTPUT, ENTER and CLEAR in order to convert the examples. The instructions are always shown between the double quotes.
1–6
Introduction to Programming
Device Address
Device Address
The location where the device address must be specified also depends on the host language that you are using. In some languages, this could be specified outside the output command. In BASIC, this is always specified after the keyword OUTPUT. The examples in this manual use a generic address of XXX. When writing programs, the number you use will depend on the protocol you use, in addition to the actual address. If you are using HP-IB, see chapter 2, "Programming Over HP-IB." If you are using RS-232-C, see chapter 3, "Programming Over RS-232-C." If you are using Ethernet LAN, see chapter 4, "Programming Over LAN."
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>. There are just a few instructions which use block data.
Instructions are composed of two main parts: the header, which specifies the command or query to be sent; and the parameters, which provide additional data needed to clarify the meaning of the instruction. Many queries do not use any parameters.
Instruction Header
The instruction header is one or more keywords separated by colons (:). The command tree for the mainframe in figure 5-1 illustrates how all the keywords can be joined together to form a complete header (see chapter 5, "Programming and Documentation Conventions").
The example in figure 1-1 shows 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 parameters.
1–7
Introduction to Programming
Instruction Terminator
When you look up a query in this programmer’s reference, you’ll find a paragraph labeled "Returned Format" under the one labeled "Query." The syntax definition by "Returned Format" will always show the instruction header in square brackets, like [:SYSTem:MENU], which means the text between the brackets is optional. It is also a quick way to see what the header looks like.
White Space
White space is used to separate the instruction header from the instruction parameters. If the instruction does not use any parameters, white space does not need to be included. White space is defined as one or more spaces. ASCII defines a space to be a character, represented by a byte, that has a decimal value of 32. Tabs can be used only if your controller first converts them to space characters before sending the string to the system.
Instruction Parameters
Instruction parameters are used to clarify the meaning of the command or query. They provide necessary data, such as whether a function should be on or off, which waveform is to be displayed, or which pattern is to be looked for. Each instruction’s syntax definition shows the parameters, as well as the range of acceptable values they accept. This chapter’s "Parameter Data Types" section has all of the general rules about acceptable values.
When there is more than one parameter, they are separated by commas (,). White space surrounding the commas is optional.
Instruction Terminator
An instruction is executed after the instruction terminator is received. The terminator is the NL (New Line) character. The NL character is an ASCII linefeed character (decimal 10).
The NL (New Line) terminator has the same function as an EOS (End Of String) and EOT (End Of Text) terminator.
1–8
Header Types
There are three types of headers: simple command, compound command, and common command.
Simple Command Header
Simple command headers contain a single keyword. START and STOP are examples of simple command headers. The syntax is:
<function><terminator>
When parameters (indicated by <data>) must be included with the simple command header, the syntax is: <function><white_space><data>
<terminator>
Example :RM ODE SINGLE<terminator>
Introduction to Programming
Header Types
Compound Command Header
Compound command headers are a combination of two or more program keywords. The first keyword selects the subsystem, and the last keyword selects the function within that subsystem. Sometimes you may need to list more than one subsystem before being allowed to specify the function. The keywords within the compound header are separated by colons. For example, to execute a single function within a subsystem, use the following:
:<subsystem>:<function><white_space><data><terminator>
Example :SYSTEM:LONGFORM ON
To traverse down one level of a subsystem to execute a subsystem within that subsystem, use the following: <subsystem>:<subsystem>:<function><white_space>
<data><terminator>
Example :MMEMORY:LOAD:CONFIG "FILE "
1–9
Introduction to Programming
Duplicate Keywords
Common Command Header
Common command headers control IEEE 488.2 functions within the logic analyzer such as clear status. The syntax is: *<command header><terminator>
No white space or separator is allowed between the asterisk and the command header.
Example *CLS
Combined Commands in the Same Subsystem
To execute more than one function within the same subsystem, a semicolon (;) is used to separate the functions:
:<subsystem>:<function><white space><data>;<function> <white space><data><terminator>
Example :SYSTEM:LONGFORM ON;HEADER ON
Duplicate Keywords
Identical function keywords can be used for more than one subsystem. For example, the function keyword MMODE may be used to specify the marker mode in the subsystem for state listing or the timing waveforms:
:SLIST:MMODE PATTERN - sets the marker mode to pattern in the state
listing. :TWAVEFORM:MMODE TIME - sets the marker mode to time in the timing
waveforms.
SLIST and TWAVEFORM are subsystem selectors, and they determine which marker mode is being modified.
1–10
Introduction to Programming
Query Usage
Query Usage
Logic analysis system instructions that are immediately followed by a question mark (?) are queries. After receiving a query, the Logic Analysis System parser places the response in the output buffer. The output message remains in the buffer until it is read or until another instruction is issued. When read, the message is transmitted across the bus to the designated listener (typically a controller).
Query commands are used to find out how the system is currently configured. They are also used to get results of measurements made by the modules in the system.
Example This instruction places the current full-screen time for machine 1 of the logic
analyzer module in slot 2 in the output buffer.
:SEL EC T 2: MACHINE1:T WAVEFORM:R ANGE?
In order to prevent the loss of data in the output buffer, the output buffer must be read before the next program message is sent. Sending another command before reading the result of the query will cause the output buffer to be cleared and the current response to be lost. This will also generate a "QUERY UNTERMINATED" error in the error queue. For example, when you send the query :SELECT 2:TWAVEFORM:RANGE? you must follow that with an input statement. In BASIC, this is usually done with an ENTER statement.
In BASIC, the input statement, ENTER XXX; Range, passes the value across the bus to the controller and places it in the variable Range.
Additional details on how to use queries is in the next section of this chapter, "Receiving Information from the Logic Analysis System."
1–11
Introduction to Programming
Program Header Options
Program Header Options
Program headers can be sent using any combination of uppercase or lowercase ASCII characters. System responses, however, are always returned in uppercase.
Both 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.
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 the amount of I/O activity.
The rules for short form syntax are discussed in chapter 5, "Programming and Documentation Conventions."
Example Either of the following examples turns on the headers and long form.
Long form:
OUT PUT XXX;":SYSTEM:HEADER ON ;LONGFORM ON"
Short form:
OUT PUT XXX;":SYST:HEAD ON;LON G ON"
1–12
Introduction to Programming
Parameter Data Types
Parameter Data Types
There are three main types of data which are used in parameters. The types are numeric, string, and keyword. A fourth type, block data, is used only for a few instructions: the DATA and SETup instructions in the SYSTem subsystem (see chapter 11); the CATalog, UPLoad, and DOWNload instructions in the MMEMory subsystem (see chapter 12). These syntax rules also show how data may be formatted when sent back from the system as a response.
The parameter list always follows the instruction header and is separated from it by white space. When more than one parameter is used, they are separated by commas. You are allowed to include one or more white spaces around the commas, but it is not mandatory.
Numeric data
For numeric data, you have the option of using exponential notation or using suffixes to indicate which unit is being used. However, exponential notation is only applicable to the decimal number base. Do not combine an exponent with a unit.
See Also Tables 6-1 and 6-2 in chapter 6, "Message Communications and System
Functions," list all available suffixes.
Example The following numbers are all equal:
28 = 0.28E2 = 280E-1 = 28000m = 0.028K.
The system will recognize binary, octal, and hexadecimal base numbers. The base of a number is specified with a prefix. The recognized prefixes are #B for binary, #Q for octal, and #H for hexadecimal. The absence of a prefix indicates the number is decimal which is the default base.
Example The following numbers are all equal:
#B11100 = #Q34 = #H1C = 28
1–13
Introduction to Programming
Parameter Data Types
You may not specify a base in conjunction with either exponents or unit suffixes. Additionally, negative numbers must be expressed in decimal.
When a syntax definition specifies that a number is an integer, that means that the number should be whole. Any fractional part would be ignored, truncating the number. Numeric parameters that accept fractional values are called real numbers.
All numbers are expected to be strings of ASCII characters. Thus, when sending the number 9, you send a byte representing the ASCII code for the character "9" (which is 57, or 0011 1001 in binary). A three-digit number, like 102, will 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.
String data
String data may be delimited with either single (’) or double (") quotes. String parameters representing labels are case-sensitive. For instance, the labels "Bus A" and "bus a" are unique and can not be used interchangeably. Also pay attention to the presence of spaces, because they act as legal characters just like any other. So, the labels "In" and " In" are also two different labels.
Keyword data
In many cases a parameter must be a keyword. The available keywords 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 responses, uppercase letters will be used exclusively. The use of long form or short form in a response depends on the setting you last specified via the :SYSTem:LONGform command.
1–14
Introduction to Programming
Selecting Multip le Subsystem s
Selecting Multiple Subsystems
You can send multiple program commands and program queries for different subsystems within the same selected module on the same line by separating each command with a semicolon. The colon following the semicolon enables you to enter a new subsystem. <instruction header><data>;
:<instruction header><data><terminator>
Multiple commands may be any combination of simple, compound and common commands.
Example :SEL EC T 2; :MACHINE1: ASSIGN2;:S YSTEM:HEADERS ON
1–15

Receiving Information from the Logic Analysis System

After receiving a query (logic analysis system instruction followed by a question mark), the system interrogates the requested function and places the answer in its output queue. The answer remains in the output queue until it is read or until another command is issued. When read, the message is transmitted across the bus to the designated listener (typically a controller). The input statement for receiving a response message from the system’s output queue usually has two parameters: the device address and a format specification for handling the response message.
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 :SYSTEM:LONGFORM?, you must follow that query with an input statement. In BASIC, this is usually done with an ENTER statement and in C with a read command.
The format for handling the response messages is dependent on both the controller and the programming language.
Example To read the result of the query command :SYSTEM:LONGFORM? you
can execute this BASIC statement to enter the current setting for the long form command in the numeric variable Setting.
ENTER XXX; Setting
1–16
Introduction to Programming
Response Header Options
Response Header Options
The format of the returned ASCII string depends on the current settings of the SYSTEM HEADER and LONGFORM commands. The general format is
<instruction_header><space><data><terminator>
The header identifies the data that follows (the parameters) and is controlled by issuing a :SYSTEM:HEADER ON/OFF command. If the state of the header command is OFF, only the data is returned by the query.
The format of the header is controlled by the :SYSTEM:LONGFORM command. If long form is OFF , the header will be in its short form and the header will vary in length, depending on the particular query. The separator between the header and the data always consists of one space.
A command or query may be sent in either long form or short form, or in any combination of long form and short form. The HEADER and LONGFORM commands only control the format of the returned data and they have no affect on the way commands are sent.
Example The following examples show some possible responses for a
:SELECT 2:MACHINE1:SFORMAT:THRESHOLD2? query: with HEADER OFF:
<data><terminator>
with HEADER ON and LONGFORM OFF:
:SE L 2:MACH1:SFOR:THR2<whit e_space><data><terminator>
with HEADER ON and LONGFORM ON:
:SEL EC T 2: MACHINE1:S FORMAT:THR ESHOLD2<white_ space> <dat a> <t erminator>
See Also Chapter 11, "SYSTem Subsystem" for information on turning the HEADER
and LONGFORM commands on and off.
1–17
Introduction to Programming
Response Data Formats
Response Data Formats
Both numbers and strings are returned as a series of ASCII characters, as described in the following sections. Keywords in the data are returned in the same format as the header, as specified by the LONGform command. Like the headers, the keywords will always be in uppercase.
Example The following are possible responses to the :SELECT 2:MACHINE1:
TFORMAT: LAB? ’ADDR’ query.
Header on; Longform on
:SELECT 2:MACHINE1:TFORMAT:LABEL "ADDR ",19, POSITIVE<terminator>
Header on;Longform off
:SEL 2:MACH1:TFOR:LAB "ADDR ",19,POS<terminator>
Header off; Longform on
"ADDR ",19,POSITIVE<terminator>
Header off; Longform off
"ADDR ",19,POS<terminator>
See Also The individual commands in Part 2 of this guide contain information on the
format (string or numeric) of the data returned from each query.
1–18
Introduction to Programming
String Variables
String Variables
Because there are so many ways to code numbers, the HP 16500C Logic Analysis System handles almost all data as ASCII strings. Depending on your host language, you may be able to use other types when reading in responses.
Sometimes it is helpful to use string variables in place of constants to send instructions to the system, such as including the headers with a query response.
Example This example combines variables and constants in order to make it easier to
switch from MACHINE1 to MACHINE2 in slot 3. In BASIC, the & operator is used for string concatenation.
10 LET Machine$ = ":SELECT 3:MACHINE2" !Send all instructions to machine 2 in
!slo t 3 20 OUTPUT XXX; Machine$ & ":TYPE STATE" !Make machine a state analyzer 30 ! Assign all labels to be positive 40 OUTPUT XXX; Machine$ & ":SFORMAT:LABEL ’CHAN 1’, POS" 50 OUTPUT XXX; Machine$ & ":SFORMAT:LABEL ’CHAN 2’, POS" 60 OUTPUT XXX; Machine$ & ":SFORMAT:LABEL ’OUT’, POS" 99 END
If you want to observe the headers for queries, you must bring the returned data into a string variable. Reading queries into string variables requires little attention to formatting.
Example This command line places the output of the query in the string variable
Result$.
ENTE R XX X; Result$
The output of the system may be numeric or character data depending on what is queried. Refer to the specific commands in Part 2 of this guide for the formats and types of data returned from queries.
1–19
Introduction to Programming
Numeric Base
Example The following example shows logic analyzer module data being returned to a
string variable with headers off:
10 OUTPUT XXX;":SYSTEM:HEADER OFF" 20 DI M Rang$[30] 30 OUTPUT XXX;":SELECT 2:MACHINE1:TWAVEFORM:RANGE?" 40 EN TER XXX;Rang$ 50 PR INT Rang$ 60 END
After running this program, the controller displays: +1.00000E-05
Numeric Base
Most numeric data will be returned in the same base as shown on screen. When the prefix #B precedes the returned data, the value is in the binary base. Likewise, #Q is the octal base and #H is the hexadecimal base. If no prefix precedes the returned numeric data, then the value is in the decimal base.
Numeric Variables
If your host language can convert from ASCII to a numeric format, then you can use numeric variables. Turning off the response headers will help you avoid accidentally trying to convert the header into a number.
1–20
Introduction to Programming
Definite-Length Block Response Data
Example The following example shows logic analyzer module data being returned to a
numeric variable.
10 OUTPUT XXX;":SYSTEM:HEADER OFF" 20 OUTPUT XXX;":SELECT 2:MACHINE1:TWAVEFORM:RANGE?" 30 EN TER XXX;Rang 40 PR INT Rang 50 END
This time the format of the number (whether or not exponential notation is used) is dependent upon your host language. In BASIC, the output will look like: 1.E-5
Definite-Length Block Response Data
Definite-length block response data, also referred to as block data, allows any type of device-dependent data to be transmitted over the system interface as a series of data bytes. Definite-length block data is particularly useful for sending large quantities of data or for sending 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. Following the non-zero digit is the decimal integer that states the number of 8-bit data bytes to follow. This number is followed by the actual data.
Indefinite-length block data is not supported on the HP16500C Logic Analysis System.
1–21
Figure 1-2
Introduction to Programming
Multiple Queries
For example, for transmitting 80 bytes of data, the syntax would be:
Definite-length Block Re sponse Data
The "8" states the number of digits that follow, and "00000080" states the number of bytes to be transmitted, which is 80.
Multiple Queries
You can send multiple queries to the system 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.
Example You can read the result of the query :SYSTEM:HEADER?;LONGFORM? into
the string variable Results$ with the BASIC command:
ENTER XXX; Results$
When you read the result of multiple queries into string variables, each response is separated by a semicolon.
1–22
Introduction to Programming
System Status
Example The response of the query :SYSTEM:HEADER?:LONGFORM? with HEADER
and LONGFORM turned on is:
:SYSTEM:HEADER 1;:SYSTEM:LONGFORM 1
If you do not need to see the headers when the numeric values are returned, then you could use numeric variables. When you are receiving numeric data into numeric variables, the headers should be turned off. Otherwise the headers may cause misinterpretation of returned data.
Example The following program message in HP BASIC is used to read the query
:SYSTEM:HEADERS?;LONGFORM? into multiple numeric variables:
ENTER XXX; Result1, Result2
System Status
Status registers track the current status of the mainframe and the installed modules. By checking the system status, you can find out whether an operation has been completed, whether a module is receiving triggers, and more.
See Also Chapter 7, "Status Reporting," explains how to check the status of the system
and the installed modules.
1–23
1–24
2

Programming Over HP-IB

Introduction
This section describes the interface functions and some general concepts of HP-IB. In general, these functions are defined by IEEE
488.1 (HP-IB standard). They deal with general bus management issues, as well as messages which can be sent over the bus as bus commands.
2–2
Programming Over HP-IB

Interface Capabilities

Interface Capabilities
The interface capabilities of the HP 16500C, as defined by IEEE 488.1 are SH1, AH1, T5, TE0, L3, LE0, SR1, RL1, PP0, DC1, DT1, C0, and E2.

Command and Data Concepts

The HP-IB has two modes of operation: command mode and data mode. The bus is in 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. These device-dependent messages include all of the commands and responses found in chapters 10 through 14 of this guide for the mainframe and the respective Programmer’s Guides for each module installed in the mainframe.

Talk/Listen Addressing

By using the touchscreen fields in the System Configuration menu, the HP-IB interface can be placed in talk-only mode by connecting to the printer or in addressed talk/listen mode by connecting to the controller.
See Also Chapter 3, "Configuring Communications" in the HP 16500C User’s
Reference
Talk-only mode must be used when you want the system to talk directly to a printer without the aid of a controller. Addressed talk/listen mode is used when the system will operate in conjunction with a controller. When the system is in the addressed talk/listen mode, the following is true:
Each device on the HP-IB resides at a particular address ranging from 0 to
30. The active controller specifies which devices will talk and which will listen.
2–3
Programming Over HP-IB

HP-IB Bus Addressing

An instrument, therefore, may be talk-addressed, listen-addressed, or
unaddressed by the controller.
If the controller addresses the instrument to talk, it will remain configured to talk until it receives:
an interface clear message (IFC)
another instrument’s talk address (OTA)
its own listen address (MLA)
a universal untalk (UNT) command.
If the controller addresses the instrument to listen, it will remain configured to listen until it receives:
an interface clear message (IFC)
its own talk address (MTA)
a universal unlisten (UNL) command.
HP-IB Bus Addressing
Because HP-IB can address multiple devices through the same interface card, the device address passed with the program message must include not only the correct instrument address, but also the correct interface code.
Interface Select Code (Selects the Interface)
Each interface card has its own interface select code. This code is used by the controller to direct commands and communications to the proper interface. The default is always "7" for HP-IB controllers.
Instrument Address (Selects the Instrument)
Each instrument on the HP-IB port must have a unique instrument address between decimals 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.
2–4
Programming Over HP-IB

Local, Remote, and Local Lockout

Example For example, if the instrument address is 4 and the interface select code is 7,
the instruction will cause an action in the instrument at device address 704.
DEVICE ADDRESS = (Interface Select Code) X 100 + (Instrument Address)
Local, Remote, and Local Lockout
The local, remote, and remote with local lockout modes may be used for various degrees of front-panel control while a program is running. The logic analysis system will accept and execute bus commands while in local mode, and the front panel will also be entirely active. If the HP 16500C is in remote mode, the system will go from remote to local with any touchscreen, mouse, or keyboard activity. In remote with local lockout mode, all controls (except the power switch) are entirely locked out. Local control can only be restored by the controller.
Hint Cycling the power will also restore local control, but this will also reset
certain HP-IB states. It also resets the system to the power-on defaults and purges any acquired data in the acquisition memory of all the installed modules.
The instrument is placed in remote mode by setting the REN (Remote Enable) bus control line true, and then addressing the instrument to listen. The instrument can be placed in local lockout mode by sending the local lockout (LLO) command. The instrument can be returned to local mode by either setting the REN line false, or sending the instrument the go to local (GTL) command.
See Also :SYSTem:LOCKout in chapter 10, "Mainframe Commands"
2–5
Programming Over HP-IB

Bus Commands

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 system.
Device Clear
The device clear (DCL) or selected device clear (SDC) commands clear the input and output buffers, reset the parser, clear any pending commands, and clear the Request-OPC flag.
Group Execute Trigger (GET)
The group execute trigger command will cause the same action as the START command for Group Run: the instrument will acquire data for the active waveform and listing displays.
Interface Clear (IFC)
This 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.
2–6
3

Programming Over RS-232-C

Introduction
This chapter describes the interface functions and some general concepts of 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. 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.
3–2
Programming Over RS-232-C

Interface Operation

Interface Operation
The HP 16500C Logic Analysis System can be programmed by 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. When you are controlling an HP 16500C Logic Analysis System over RS-232-C, 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 DTE devices, certain considerations must be taken into account. For a three-wire interface, XON/XOFF must be used to handle protocol between the devices. For an extended hardwire interface, protocol may be handled either with XON/XOFF or by manipulating the CTS and RTS lines of the RS-232-C link. In all cases, the DCD and DSR lines to the Logic Analysis System must remain high for proper operation.
With extended hardwire operation, a high on the CTS line allows the Logic Analysis System to send data, and a low prevents the Logic Analysis System from transmitting data. Likewise, a high on the RTS line allows the controller to send data, and a low signals a request for the controller to disable data transmission. Because a three-wire interface has no control over the CTS line, internal pull-up resistors in the Logic Analysis System assure that this line remains high for proper three-wire operation.

RS-232-C Cables

The correct cable for the RS-232-C interface depends on your specific application and whether you use software or hardware handshake protocol. The following paragraphs describe which lines of the HP 16500C Logic Analysis System are used to control the handshake operation of RS-232-C relative to the system. To locate the proper cable for your application, refer to the reference manual for your computer or controller. It should describe the exact handshake protocol your controller can use to operate over an RS-232-C bus. In this chapter you will also find HP cable recommendations for hardware handshake.
3–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 Logic Analysis System and the controller. Because the three-wire interface provides no hardware means to control data flow between the controller and the Logic Analysis System, only XON/OFF can control this data flow. The three-wire interface provides a much simpler connection between devices since you can ignore hardware handshake requirements.
The communications software you are using in your computer/controller must be capable of u sing XON/XOFF exclusively in order to use three-wire interface cables. For example, some communications software packages can use XON/XOFF but also depend on the CTS and DSR lines being tru e to communicate.
The Logic Analysis System uses the following connections on its RS-232-C interface for three-wire communication:
Pin 5 SGND (Signal Ground)
Pin 3 TD (Transmit Data from Logic Analysis System)
Pin 2 RD (Receive Data into Logic Analysis System)
The TD (Transmit Data) line from the Logic Analysis System must connect to the RD (Receive Data) line on the controller. Likewise, the RD line from the Logic Analysis System must connect to the TD line on the controller. Internal pull-up resistors in the Logic Analysis System assure the DCD, DSR, and CTS lines remain high when you are using a three-wire interface.
3–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 Logic Analysis System and the controller. The Logic Analysis System uses the following connections on its RS-232-C interface for extended interface communication:
Pin 5 SGND (Signal Ground)
Pin 3 TD (Transmit Data from Logic Analysis System)
Pin 2 RD (Receive Data into Logic Analysis System)
The additional lines you use depends on your controller’s implementation of the extended hardwire interface.
Pin 7 RTS (Request To Send) is an output from the Logic Analysis
System which can be used to control incoming data flow. Pin 8 CTS (Clear To Send) is an input to the Logic Analysis System
which controls data flow from the Logic Analysis System. Pin 6 DSR (Data Set Ready) is an input to the Logic Analysis System
which controls data flow from the Logic Analysis System within two bytes. Pin 1 DCD (Data Carrier Detect) is an input to the Logic Analysis
System which controls data flow from the Logic Analysis System within two bytes.
Pin 4 DTR (Data Terminal Ready) is an output from the Logic Analysis
System which is enabled as long as the Logic Analysis System is turned on.
The TD (Transmit Data) line from the Logic Analysis System must connect to the RD (Receive Data) line on the controller. Likewise, the RD line from the Logic Analysis System must connect to the TD line on the controller.
The RTS (Request To Send) is an output from the Logic Analysis System which can be used to control incoming data flow. A true on the RTS line allows the controller to send data and a false 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 Logic Analysis System, which control data flow from the Logic Analysis System. Internal pull-up resistors in the Logic Analysis System 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 along with the CTS line high to enable the Logic Analysis System to send data to the controller. A low on any one of these
3–5
Programming Over RS-232-C

Cable Exampl es

lines will disable the Logic Analysis System data transmission. Pulling the CTS line low during data transmission will stop Logic Analysis System data transmission immediately. Pulling either the DSR or DCD line low during data transmission will stop Logic Analysis System data transmission, but as many as two additional bytes may be transmitted from the Logic Analysis System.
Cable Examples
HP 9000 Series 300
Figure 3-1 is an example of how to connect the HP 16500C Logic Analysis System to the HP 98628A Interface card of an HP 9000 series 300 controller. For more information on cabling, refer to the reference manual for your specific controller.
Because this example does not have the correct connections for hardware handshake, you must use the XON/XOFF protocol when connecting the Logic Analysis System.
Figure 3-1
Cable Example
3–6
Figure 3-2
Programming Over RS-232-C

Configuring the Logic Analysis System Interface

HP Vectra Personal Computers and Compatibles
Figure 3-2 gives an example of a cable that will work for the extended interface with hardware handshake. Keep in mind that this cable should work if your computer’s serial interface supports the four common RS-232-C handshake signals as defined by the RS-232-C standard. The four common handshake signals are Data Carrier Detect (DCD), Data Terminal Ready (DTR), Clear to Send (CTS), and Ready to Send (RTS).
Figure 3-2 shows the schematic of a 9-pin female to 25-pin male cable. The following HP cables support this configuration:
HP 24542G, DB-9(F) to DB-25(M), 3 meter
HP 24542H, DB-9(F) to DB-25(M), 3 meter, shielded
HP 45911-60009, DB-9(F) to DB-25(M), 1.5 meter
9-pin (F) to 25-pin (M) Cable
Configuring the Logic Analysis System Interface
The RS-232 Settings field in the System Configuration Menu allows you access to the RS-232 Settings menu where the RS-232-C interface is configured. If you are not familiar with how to configure the RS-232-C interface, refer to chapter 3, "Configuring Communications," in the HP 16500C Logic Analysis System User’s Reference.
3–7
Programming Over RS-232-C

Interface Capabilities

Interface Capabilities
The baud rate, stop bits, parity, protocol, and data bits must be configured exactly the same for both the controller and the Logic Analysis System to properly communicate over the RS-232-C bus. The RS-232-C interface capabilities of the HP 16500C Logic Analysis System are listed below:
Baud Rate: 110, 300, 600, 1200, 2400, 4800, 9600, or 19.2k
Stop Bits: 1, 1.5, or 2
Parity: None, Odd, or Even
Protocol: None or XON/XOFF
Data Bits: 8
Protocol NONE With a three-wire interface, selecting NONE for the 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 NONE allows a hardware handshake to occur. With hardware handshake, the hardware signals control data flow.
XON/XOFF XON/XOFF stands for Transmit On/Transmit Off. With this mode, the receiver (controller or Logic Analysis System) controls data flow and can request that the sender (Logic Analysis System or controller) stop data flow. By sending XOFF (ASCII 19) over its transmit data line, the receiver requests that the sender disables data transmission. A subsequent XON (ASCII 17) allows the sending device to resume data transmission.
Data Bits
Data bits are the number of bits sent and received per character that represent the binary code of that character. Characters consist of either 7 or 8 bits, depending on the application. The HP 16500C Logic Analysis System supports 8-bit only.
8-Bit Mode Information is usually stored in bytes (8 bits at a time). With 8-bit mode, you can send and receive data just as it is stored, without the need to convert the data.
3–8
Programming Over RS-232-C

RS-232-C Bus Addressing

The controller and the HP 16500C Logic Analysis System must be in the same bit mode to properly communicate over the RS-232-C. This means that the controller must have the capability to send and receive 8-bit data.
See Also For more information on the RS-232-C interface, refer to the HP 16500C
Logic Analysis System User’s Reference. For information on RS-232-C voltage levels and connector pinouts, refer to the HP 16500C Logic Analysis System Service Guide.
RS-232-C Bus Addressing
The RS-232-C address you must use is dependent on the computer or controller you are using to communicate with the Logic Analysis System.
HP Vectra Personal Computers or compatibles
If you are using an HP Vectra Personal Computer or compatible, it must have an unused serial port to which you connect the Logic Analysis System’s RS-232-C port. The proper address for the serial port is dependent on the hardware configuration of your computer. Additionally, your communications software must be configured to address the proper serial port. Refer to your computer and communications software manuals for more information on setting up your serial port address.
HP 9000 Series 300 Controllers
Each RS-232-C interface card for the HP 9000 Series 300 Controller has its own interface select code. This code is used by the controller for directing commands and communications to the proper interface by specifying the correct interface code for the device address.
Generally, the interface select code can be any decimal value between 0 and 31, except for those interface codes which are reserved by the controller for internal peripherals and other internal interfaces. This value can be selected through switches on the interface card. For example, if your RS-232-C interface select code is 9, the device address required to communicate over the RS-232-C bus is 9. For more information, refer to the reference manual for your interface card or controller.
3–9
Programming Over RS-232-C

Lockout Command

Lockout Command
To lockout the front-panel controls, use the SYSTem command LOCKout. When this function is on, all controls (except the power switch) are entirely locked out. Local control can only be restored by sending the :LOCKout OFF command.
Hint Cycling the power will also restore local control, but this will also reset
certain RS-232-C states. It also resets the Logic Analysis System to the power-on defaults and purges any acquired data in the acquisition memory of all the installed modules.
See Also For more information on this command see chapter 11, "SYSTem Subsystem."
3–10
4

Programming Over LAN

Introduction
This chapter describes different ways you can program your logic analysis system over a LAN. There are no commands needed for controlling the connection, and no special cabling issues. This chapter assumes you have already set up your LAN, and concentrates on how to control the HP 16500C from a host computer.
4–2
Programming Over LAN

Communicating with the HP 16500C

Communicating with the HP 16500C
You can communicate with the HP 16500C in several ways. If you NFS mount your logic analysis system, it behaves like a disk drive on your LAN and programs control it by writing to the common way to control the instrument is through telnet or another socket-style connection.
The HP 16500C must be turned on and completely booted up before you can mount the s ystem to your network. Once power is applied to the system and the System Configur ation menu is displayed, allow an additional 15 seconds before attempting to connect to the system.
The LAN connection does not provide real-time programming control. Due to the message handling protocol of Ethernet LAN, messages take an indeterminate amount of time to reach their destinations. There can be no guarantee that commands sent from your computer will reach the HP 16500C in a timely way, although the majority of messages do.
\sys tem\program file. The other

LAN Addressing

All devices on an Ethernet LAN are uniquely identified by their Ethernet address. The Ethernet address is set in the hardware of any Ethernet­capable device.
However, the utilities you use to communicate with the HP 16500 Logic Analysis System follow the TCP/IP protocol. This protocol assigns unique IP addresses in software. When you connected your logic analysis system to your LAN, you or your system administrator assigned an IP address to the HP 16500C. Use this address to communicate with the HP 16500C. You can check the address by selecting LAN Settings in the System Configuration menu.
4–3
Programming Over LAN

Password Protection and File Protection

Password Protection and File Protection
There is no protection or security built into the HP 16500C. If you attempt to connect to the logic analysis system via FTP, and you are prompted for a password, leave the password field blank.
The operating system files, which are stored in the also not protected against accidental deletion. If these files are deleted, the HP 16500C will not operate the next time it is rebooted. If you do delete any of these files, copy them from the flexible disks labeled "16500 Operating System" back onto the hard disk, into the
\system directory.
\sys tem directory, are

Permission Levels: Control and Data

The HP 16500C system can be mounted on your network with two different levels of access, "control" or "data." When you mount the HP 16500 system, you specify the type of access. The general syntax for mounting is:
UNIX
mount [host or IP address]:/[control|data] /[drive name]
DOS net use [drive name] [host or IP address]:/[control|data]
net use [drive name] \\[host or IP address]\[control|data]
There are two differences between control and data permissions. First, the control level provides read and write access to all files. The data level provides write access only for the disk drives, and read access for all other files. Second, control allows you to send programming commands to the HP 16500C system, and data level does not.
You must be connected as the control user to program the HP 16500C.
The HP 16500C will accommodate one data and one control user at a time. There can be only one control user at any time through any of the connection methods – NFS mount, ftp, telnet, or using a socket. For example, if you ftp to the HP 16500C as control, no one else can program it through any of the other methods.
4–4
Programming Over LAN

Controlling the HP 16500C

Controlling the HP 16500C
To control the HP 16500C Logic Analysis System with programming commands, you can either write the commands to open a socket in a C program. Either way, the controller in the System Configuration menu must be set to LAN.
In order to s end programming commands to the HP 16500C \system\program file, the system must be connected to the LAN and you must be connected to the system as the control user.
The \system\program file
Once the logic analysis system is connected to your network, you can send commands to the system by sending them as text strings to the file location \system\program. You can send the strings using a variety of methods:
echo a string from the command line to \system\program
copy an ASCII file containing a series of commands to \system\program
from within a C or BASIC program, open the file \system\program and
write the commands to it using "fwrite" or "output".
\system\program, or
Sockets
If you are programming in C or another language that supports sockets, you can write strings directly to the HP 16500C system. Socket connections are automatically control users, so if someone else is already connected to the logic analysis system as control user you will not be able to connect. You can also directly connect to the parser socket using telnet, and send commands interactively. All socket connections, including telnet, need to specify port or address 5025.
4–5
Programming Over LAN

Echoing Commands

Echoing Commands
To send a command directly from the command line or prompt of your PC or workstation to the HP 16500C system, echo a text string containing the command to the file location
In order to send commands to the HP 16500C system parser, you must be connected to the system as the control user.
Example To run the logic analyzer and acquire data, at the DOS prompt enter:
c:>echo :START > L:\system\program
If you are using a UNIX system, you can use the UNIX echo command.
\system\program.
Example An HP 16550A state/timing analyzer is installed in slot C (slot 3) of your
HP 16500C mainframe. To clear the trigger set-up on the HP 16550A, at the DOS prompt enter:
c:>e ch o :S ELECT 3 > L:\sys tem\progra m c:>echo :MACHINE1:STRIGGER:CLEAR ALL > L:\system\program
If you are using a UNIX system, you can use the UNIX echo command. The first command selects the state/timing analyzer in slot C. The second command clears the trigger.
4–6
Programming Over LAN

Copying Command Files

Copying Command Files
To control the HP 16500C system with longer sets of commands, you can first type the commands into an ASCII file. You then copy the file to the HP 16500 program file, at location are passed on to the HP 16500C system’s command parser.
Example An HP 16550A state/timing analyzer is installed in slot C (slot 3) of your
HP 16500C mainframe. To clear the format and trigger set-ups on the HP 16550A, using a program file, first type the commands into an ASCII text file.
File clear.txt:
:SEL EC T 3 :MACHINE1:SFORMAT:REMOVE ALL :MACHINE1:STRIGGER:CLEAR ALL
The first command selects the state/timing analyzer in slot C to receive programming commands. The second command clears the format set-up. The third command clears the trigger set-up.
Now copy the file to the HP 16500 system. At the DOS prompt enter:
\system\program. Files copied to this file location
cop y clear.txt L:\system\prog ram
If you are using a UNIX system, you might use the cp command. In an MS-Windows environment, you can use File Manager.
4–7
Programming Over LAN Writing to \system\program from a Program

Writing to \system\program from a Program

You can send commands to the HP 16500C program file from a program running on your PC or workstation. The basic procedure is to open the program file and send text strings containing the commands to the file. In C, you can use the program file.
Your operating system may buffer the commands before sending them to the HP 16500C system. To prevent this, you may need to empty the buffer after each command. In C, you can use the
Queries
Responses to queries appear as text strings in retrieve information from queries, create a text buffer, open the and read the contents of the file into the buffer. In C you can use the or gets tr commands to read the contents of the file into the buffer. Whenever you send queries to the HP 16500 system, you will need to pause your program for a short time, to allow the system to process the query before you attempt to read the response. A time equal to or slightly greater than the file timeout is sufficient.
fwrite or putstr commands to write text strings to the
flush command to empty the buffer.
\system\program. To
prog ram file
fread
Resetting the File Pointer
Whenever you change from reading
\system\program to writing to it, or
from writing to reading, you will need to reset the file pointer to the beginning of the file. In C, you can use the
rewind command to reset the
pointer, or you can close the program file, then immediately re-open it.
4–8
Programming Over LAN
Writing to \system\program from a Program
Example The following example in C opens the \system\program file and sends
several commands and queries. Responses to queries appear as text strings
\system\program. The HP 16500C has been NFS-mounted in the \users
in directory.
#include <stdio.h> #in clude <unistd.h>
#def in e ST R_LEN 80
void putstr(FILE *file, char *str) { fwrite(str, strlen(str), 1, file); }
int getstr(FILE *file, char* str) { return(fread(str, 1, STR_LEN, file)); }
voi d main() { FILE *file; int num; char receive_str[STR_LEN];
/* Send a query and retrieve and print the response*/ file = fopen("/users/system/program", "r"); while (getstr(file, receive_str) != 0); fclose(file); file = fopen("/users/system/program", "w"); putstr(file, "*idn?\n"); fclose(file); sleep(1); file = fopen("/users/system/program", "r"); while (getstr(file, receive_str) == 0); fclose(file); printf("%s\n", receive_str);
4–9
Programming Over LAN
Writing to \system\program from a Program
/*S end command strings to the HP165 00*/ file = fopen("/users/system/program", "w"); putstr(file, "*rst\n"); putstr(file, ":sel 4\n"); putstr(file, ":mach1:twav:range 1 s\n"); putstr(file, ":start\n"); putstr(file, ":mach1:twav:range 100 ns\n"); fclose(file); sleep(2); file = fopen("/users/system/program", "r"); while (getstr(file, receive_str) == 0); fclose(file); printf("%s\n", receive_str); }
4–10
Programming Over LAN

Sending Commands to the HP 165 00C Socket

Sending Commands to the HP 16500C Socket
If you are programming in C, you can use a socket to communicate with the HP 16500 system. By opening a socket connection, you can send program commands directly to the command parser. The HP 16500C system socket port identification number is 5025.
You can also connect directly to the parser socket and type commands directly to the HP 16500. The second example uses telnet to connect to the parser socket.
Example The following C program opens a socket and sends a query to request the
instrument’s identity. If someone else is already connected as control user, the socket will eventually close without receiving a response.
#include <stdio.h> #in clude <sys/types.h> #in clude <sys/socket.h> #in clude <netinet/in.h>
typedef struct sockaddr_in tdSOCKET_ADDR;
#define PARSER_PORT 5025 #define SERV_HOST_ADDR "15.10.96.12" #define PARSER_BUFFER_SIZE 100
char receiveBuffer[PARSER_BUFFER_SIZE], *cmdString = { "*IDN?\r\n" };
main () { int sockfd, port; tdSOCKET_ADDR serv_addr; char *addr;
/* Initialize a server socket */ port = PARSER_PORT; addr = SERV_HOST_ADDR ; serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = inet_addr ( addr ); serv_addr.sin_port = htons ( port );
4–11
Programming Over LAN
Sending Commands to the HP 16500 C Socket
/* Create an endpoint for communication */ sockfd = socket( AF_INET, SOCK_STREAM, 0 );
/* Initiate a connection on the created socket */ connect( sockfd, ( tdSOCKET_ADDR * )&serv_addr, sizeof ( serv_addr ) );
/* Send a message from the created socket */ send ( sockfd, cmdString, strlen ( cmdString ), 0 );
/* Receive a message from the 16500 socket */ recv ( sockfd, receiveBuffer, sizeof( receiveBuffer ),0 ); printf ( "%s\n", receiveBuffer ); close ( sockfd ); }
Example This example uses telnet to connect directly to the HP 16500 parser socket.
To remotely interact with the logic analyzer, enter:
telnet [symbolic name or IP address] 5025
You must specify the HP 16500 parser socket address 5025. You can now type commands directly to the HP 16500 system. The results of queries will appear on the command line of your PC or workstation.
To send the command which will run the analyzer and acquire data, enter:
:START
4–12
Programming Over LAN

Lockout Command

Lockout Command
To lockout the front-panel controls, use the SYSTem command LOCKout. When this function is on, all controls (except the power switch) are entirely locked out. Local control can only be restored by sending the :LOCKout OFF command.
Hint Cycling the power will also restore local control, but this will reset the Logic
Analysis System to the power-on defaults and purges any acquired data in the acquisition memory of all the installed modules.
See Also For more information on this command see chapter 11, "SYSTem Subsystem."
4–13
4–14
5

Programming and Documentation Conventions

Introduction
This chapter covers the programming conventions used in programming the instrument, as well as the documentation conventions used in this manual. This chapter also contains a detailed description of the command tree and command tree traversal.
5–2
Programming and Documentation Con ventions

Truncation Rule

Truncation Rule
The truncation rule for the keywords used in headers and parameters is:
If the long form has four or fewer characters, there is no change in the
short form. When the long form has more than four characters the short form is just the first four characters, unless the fourth character is a vowel. In that case only the first three characters are used.
There are so me commands that do not conform to the truncation rule by design. These will be not ed in their respective description pages .
Some examples of how the truncation rule is applied to various commands are shown in table 5-1.
Table 5-1
Truncation Examples
Long Form Short Form
OFF OFF DATA DATA START STAR LONGFORM LONG DELAY DEL ACCUMULATE ACC
5–3
Programming and Documentation Con ventions

Infinity Representation

Infinity Representation
The representation of infinity is 9.9E+37 for real numbers and 32767 for integers. This is also the value returned when a measurement cannot be made.

Sequential and Overlapped Commands

IEEE 488.2 makes the distinction between sequential and overlapped commands. Sequential commands finish their task before the execution of the next command starts. Overlapped commands run concurrently; therefore, the command following an overlapped command may be started before the overlapped command is completed. The overlapped commands for the HP 16500C Logic Analysis System are STARt and STOP.

Response Generation

IEEE 488.2 defines two times at which query responses may be buffered. The first is when the query is parsed by the instrument and the second is when the controller addresses the instrument to talk so that it may read the response. The HP 16500C Logic Analysis System will buffer responses to a query when it is parsed.

Syntax Diagrams

At the beginning of each chapter in Part 2, "Commands," is a syntax diagram showing the proper syntax for each command. All characters contained in a circle or oblong are literals, and must be entered exactly as shown. Words and phrases contained in rectangles are names of items used with the command and are described in the accompanying text of each command. Each line can only be entered from one direction as indicated by the arrow
5–4
Programming and Documentation Con ventions

Notation Conventions and Definitions

on the entry line. Any combination of commands and arguments that can be generated by following the lines in the proper direction is syntactically correct. An argument is optional if there is a path around it. When there is a rectangle which contains the word "space," a white space character must be entered. White space is optional in many other places.
Notation Conventions and Definitions
The following conventions are used in this manual when describing programming rules and example.
< > Angular brackets enclose words or characters that are used to symbolize a
program code parameter or a bus command
::= "is defined as." For example, A ::= B indicates that A can be replaced by B in
any statement containing A.
| "or." Indicates a choice of one element from a list. For example, A | B
indicates A or B, but not both.
... An ellipsis (trailing dots) is used to indicate that the preceding element may
be repeated one or more times.
[ ] Square brackets indicate that the enclosed items are optional.
{ } When several items are enclosed by braces and separated by vertical bars (|),
one, and only one of these elements must be selected.
XXX Three Xs after an ENTER or OUTPUT statement represent the device
address required by your controller.
<NL> Linefeed (ASCII decimal 10).
5–5
Programming and Documentation Con ventions

The Command Tree

The Command Tree
The command tree (figure 5-1) shows all commands in the HP 16500C Logic Analysis System and the relationship of the commands to each other. You should notice that the common commands are not actually connected to the other commands in the command tree. After a <NL> (linefeed - ASCII decimal 10) has been sent to the instrument, the parser will be set to the root of the command tree. Parameters are not shown in this figure. The command tree allows you to see what the system’s parser expects to receive. All legal headers can be created by traversing down the tree, adding keywords until the end of a branch has been reached.
Command Types
As shown in chapter 1, "Header Types," there are three types of headers. Each header has a corresponding command type. This section shows how they relate to the command tree.
System Commands The system commands reside at the top level of the command tree. These commands are always parsable if they occur at the beginning of a program message, or are preceded by a colon. START and STOP are examples of system commands.
Subsystem Commands Subsystem commands are grouped together under a common node of the tree, such as the MMEMORY commands.
Common Commands Common commands are independent of the tree, and do not affect the position of the parser within the tree. *CLS and *RST are examples of common commands.
5–6
Figure 5-1
Programming and Documentation Con ventions
The Command Tree
HP 16500C Command Tree
5–7
Programming and Documentation Con ventions

Tree Traversal Rules

Tree Traversal Rules
Command headers are created by traversing down the command tree. A legal command header from the command tree in figure 5-1 would be :MMEMORY:INITIALIZE. This is referred to as a compound header. As shown on the tree, branches are always preceded by colons. Do not add spaces around the colons. The following two rules apply to traversing the tree:
A leading colon (the first character of a header) or a terminator places the
parser at the root of the command tree. For example, the colon preceding MMEMORY (:MMEMORY) in the above example places the parser at the root of the command tree.
Executing a subsystem command places you in that subsystem until a
leading colon or a terminator is found. The parser will stay at the colon above the keyword where the last header terminated. Any command below that point can be sent within the current program message without sending the keywords(s) which appear above them. For example, the colon separating MMEMORY and INITIALIZE is the location of the parser when this compound header is parsed.
The following examples are written using HP BASIC 6.2 on a HP 9000 Series 300 Controller. The quoted string is placed on the bus, followed by a carriage return and linefeed (CRLF). The three Xs (XXX) shown in this manual after an ENTER or OUTPUT statement represents the device address required by your controller.
Example In this example, the colon between SYSTEM and HEADER is necessary since
SYSTEM:HEADER is a compound command. The semicolon between the HEADER command and the LONGFORM command is the required <program message unit separator> . The LONGFORM command does not need SYSTEM preceding it, since the SYSTEM:HEADER command sets the parser to the SYSTEM node in the tree.
OUT PUT XXX;":SYSTEM:HEADER ON ;LONGFORM ON"
5–8
Programming and Documentation Con ventions
Tree Traversal Rules
Example In the first line of this example, the subsystem selector is implied for the
STORE command in the compound command. The STORE command must be in the same program message as the INITIALIZE command, since the <program message terminator> will place the parser back at the root of the command tree.
OUTPUT XXX;":MMEMORY:INITIALIZE;STORE ’FILE ’,’FILE DESCRIPTION’"
Another way to send these commands is by placing MMEMORY: before the STORE command as shown in the second line of this example.
OUT PUT XXX;":MMEMORY:INITIA LIZE" OUT PUT XXX;":MMEMORY:STORE ’F ILE ’,’FILE DESCRIPTION’"
Example In this example, the leading colon before SYSTEM tells the parser to go back
to the root of the command tree. The parser can then see the SYSTEM:PRINT command.
OUT PUT XXX;":MMEM:CATALOG?; :SYSTEM:PRINT ALL"
5–9
Programming and Documentation Con ventions

Command Set Organization

Command Set Organization
The command set for the HP 16500C Logic Analysis System mainframe is divided into 6 separate groups as shown in figure 5-1. The command groups are: common commands, mainframe commands, and 4 sets of subsystem commands. In addition to the command tree in figure 5-1, a command to subsystem cross-reference is shown in table 5-1.
Each of the 6 groups of commands is described in a separate chapter in Part 2, "Commands." Each of the chapters contain a brief description of the subsystem, a set of syntax diagrams for those commands, and the commands for that subsystem in alphabetical order.
The commands are shown in the long form and short form using upper and lowercase letters. As an example, AUToload indicates that the long form of the command is AUTOLOAD and the short form of the command is AUT. Each of the commands contain a description of the command, its arguments, and the command syntax.

Subsystems

There are four subsystems in the mainframe. In the command tree (figure 5-1) they are shown as branches, with the node above showing the name of the subsystem. Only one subsystem may be selected at a time. At power on, the command parser is set to the root of the command tree; therefore, no subsystem is selected. The four subsystems in the HP 16500C Logic Analysis System are:
SYSTem – controls some basic functions of the instrument.
MMEMory – provides access to the internal disk drive.
INTermodule – provides access to the Intermodule bus (IMB).
TGTctrl – provides access to the target control signals.
5–10
Programming and Documentation Con ventions
Subsystems
Table 5-1
Alphabetic Command Cross-Reference
Command Subsystem Command Subsystem Command Subsystem
*CLS Common DAT A SYSTem PORTEDGE INTermodule *ESE Common DELete INTermodule PORTLEV INTermodule *ESR Common DOWNload MMEMory PRINt SYSTem *IDN Common DRIVe TGTctrl PULSe TGTctrl *IST Common DSP SYSTem PURGe MM EMory *OPC Common EOI Mainframe PWD MMEMory *OPT Common ERRor SYSTem REName MMEMory *PRE Common HEADer SYSTem RMODe Mainframe *RST Common HTIMe INTermodule RTC Mainframe *SRE Common INITialize MMEMory SELect Mainframe *STB Common INPort INTermodule SETColor Mainframe *TRG Common INSert INTermodule SIGNal TGTctrl *TST Common LASTstate TGTctrl SIGStatus TGTctrl *WAI Common LER Mainframe SKEW INTermodule ALL TGTctrl LOAD MMEMory STARt Mainframe AUToload MMEMory LOCKout Mainframe STATes TGTctrl AVAILable TGTctrl LONGform SYSTem STEP TGTctrl BEEPer Mainframe MENU Mainframe STOP Mainframe BITS TGTctrl MESE Mainframe STORe MMEMory CAPability Mainframe MESR Mainframe SETup SYSTem CARDcage Mainframe MKDir MMEMory TOGGle TGTctrl CATalog MMEMory MSI MMEMory TREE INTermodule CD MMEMory NAME TGTctrl TTIMe INTermodule CESE Mainframe OUTDrive INTermodule TYPE TGTctrl CESR Mainframe OUTPolar INTermodule UPLoad MMEMory COPY MMEMory OUTType INTermodule VOLume MMEMory CURSTate TGTctrl PACK MMEMory
5–11
Programming and Documentation Con ventions

Program Examples

Program Examples
The program examples in chapter 15, "Programming Examples," were written on an HP 9000 Series 300 controller using the HP BASIC 6.2 language. The programs always assume a generic address for the HP 16500C Logic Analysis System of 707. The shorter examples given in the reference sections use a generic address of XXX.
In the examples, you should pay special attention to the ways in which the command and/or query can be sent. Keywords can be sent using either the long form or short form (if one exists for that word). With the exception of some string parameters, the parser is not case-sensitive. Uppercase and lowercase letters may be mixed freely. System commands like HEADer and LONGform allow you to dictate what forms the responses take, but they have no affect on how you must structure your commands and queries.
Example The following commands all set the logic analyzer’s Timing Waveform Delay
to 100 ms. Keywords in long form, numbers using the decimal format.
OUTPUT XXX;":SELECT 2:MACHINE1:TWAVEFORM:DELAY .1"
Keywords in short form, numbers using an exponential format.
OUTPUT XXX;":SEL 2:MACH1:TWAV:DEL 1E-1"
Keywords in short form using lowercase letters, numbers using a suffix.
OUTPUT XXX;":sel 2:mach1:twav:del 100ms"
In these examples, the colon shown as the first character of the command is optional on the HP 16500C Logic Analysis System. The space between DELay and the argume nt is required.
5–12
6

Message Communication and System Functions

Introduction
This chapter describes the operation of instruments that operate in compliance with the IEEE 488.2 (syntax) standard. It is intended to give you enough basic information about the IEEE 488.2 Standard to successfully program the Logic Analysis System. You can find additional detailed information about the IEEE 488.2 Standard in ANSI/IEEE Std 488.2-1987, IEEE Standard Codes, Formats,
Protocols, and Common Commands.
The HP 16500C Logic Analysis System is designed to be compatible with other Hewlett-Packard IEEE 488.2 compatible instruments. Instruments that are compatible with IEEE 488.2 must also be compatible with IEEE 488.1 (HP-IB bus standard); however, IEEE
488.1 compatible instruments may or may not conform to the IEEE
488.2 standard. The IEEE 488.2 standard defines the message exchange protocols by which the instrument and the controller will communicate. It also defines some common capabilities, which are found in all IEEE 488.2 instruments. This chapter also contains a few items which are not specifically defined by IEEE 488.2, but deal with message communication or system functions.
The syntax and protocol for RS-232-C program messages and response messages for the HP 16500C Logic Analysis System are structured very similar to those described by IEEE 488.2. In most cases, the same structure shown in this chapter for IEEE 488.2 will also work for RS-232-C. Because of this, no additional information has been included for RS-232-C.
6–2
Message Communication and System Functio ns

Protocols

Protocols
The protocols of IEEE 488.2 define the overall scheme used by the controller and the instrument to communicate. This includes defining when it is appropriate for devices to talk or listen, and what happens when the protocol is not followed.
Functional Elements
Before proceeding with the description of the protocol, a few system components should be understood.
Input Buffer The input buffer of the instrument is the memory area where commands and queries are stored prior to being parsed and executed. It allows a controller to send a string of commands to the instrument which could take some time to execute, and then proceed to talk to another instrument while the first instrument is parsing and executing commands.
Output Queue The output queue of the instrument is the memory area where all output data are stored until read by the controller.
Parser The instrument’s parser is the component that interprets the commands sent to the instrument and decides what actions should be taken. Parsing and executing of commands begins when either the instrument recognizes a program message terminator (defined later in this chapter) or the input buffer becomes full. If you wish to send a long sequence of commands to be executed and then talk to another instrument while they are executing, you should send all the commands before sending the program message terminator.
6–3
Message Commun ication and System Functions
Protocols
Protocol Overview
The instrument and controller communicate using program messages and response messages. These messages serve as the containers into which sets of program commands or instrument responses are placed. Program messages are sent by the controller to the instrument, and response messages are sent from the instrument to the controller in response to a query message. A query message is defined as being a program message which contains one or more queries. The instrument will only talk when it has received a valid query message, and therefore has something to say. The controller should only attempt to read a response after sending a complete query message, but before sending another program message. An important rule to remember is that the instrument will only talk when prompted to, and it then expects to talk before being told to do something else.
Protocol Operation
When the instrument is turned on, the input buffer and output queue are cleared, and the parser is reset to the root level of the command tree.
The instrument and the controller communicate by exchanging complete program messages and response messages. This means that the controller should always terminate a program message before attempting to read a response. The instrument will terminate response messages except during a hardcopy output.
If a query message is sent, the next message passing over the bus should be the response message. The controller should always read the complete response message associated with a query message before sending another program message to the same instrument.
The instrument allows the controller to send multiple queries in one query message. This is referred to as sending a "compound query." As noted in chapter 1, "Multiple Queries," multiple queries in a query message are separated by semicolons. The responses to each of the queries in a compound query will also be separated by semicolons.
Commands are executed in the order they are received.
6–4
Message Communication and System Functio ns

Syntax Diagrams

Protocol Exceptions
If an error occurs during the information exchange, the exchange may not be completed in a normal manner. Some of the protocol exceptions are shown below.
Command Error A command error will be reported if the instrument detects a syntax error or an unrecognized command header.
Execution Error An execution error will be reported if a parameter is found to be out of range, or if the current settings do not allow execution of a requested command or query.
Device-specific Error A device-specific error will be reported if the instrument is unable to execute a command for a strictly device dependent reason.
Query Error A query error will be reported if the proper protocol for reading a query is not followed. This includes the interrupted and unterminated conditions described in the following paragraphs.
Syntax Diagrams
The example syntax diagram in this chapter is similar to the syntax diagrams in the IEEE 488.2 specification. Commands and queries are sent to the instrument as a sequence of data bytes. The allowable byte sequence for each functional element is defined by the syntax diagram that is shown.
The allowable byte sequence can be determined by following a path in the syntax diagram. The proper path through the syntax diagram is any path that follows the direction of the arrows. If there is a path around an element, that element is optional. If there is a path from right to left around one or more elements, that element or those elements may be repeated as many times as desired.
6–5
Figure 6-1
Message Commun ication and System Functions
Syntax Diagrams
Example syntax diagram
6–6
Message Communication and System Functio ns

Syntax Overview

Syntax Overview
This overview is intended to give a quick glance at the syntax defined by IEEE 488.2. It will help you understand many of the things about the syntax you need to know.
IEEE 488.2 defines the blocks used to build messages which are sent to the instrument. A whole string of commands can therefore be broken up into individual components.
Figure 6-1 is an example syntax diagram and figure 6-2 shows a breakdown of an example program message. There are a few key items to notice:
A semicolon separates commands from one another. Each program
message unit serves as a container for one command. The program message units are separated by a semicolon.
A program message is terminated by a <NL> (new line). The recognition
of the program message terminator, or <PMT>, by the parser serves as a signal for the parser to begin execution of commands. The <PMT> also affects command tree traversal.
Multiple data parameters are separated by a comma.
The first data parameter is separated from the header with one or more
spaces. The header SYSTEM:LONGFORM OFF is an example of a compound
header. It places the parser in the machine subsystem until the <NL> is encountered.
A colon preceding the command header returns you to the top of the
command tree.
See Also Chapter 5, "Programming and Documentation Conventions"
6–7
Figure 6-2
Message Commun ication and System Functions
Syntax Overview
<program message> Parse T ree
6–8
Message Communication and System Functio ns
Syntax Overview
Upper/Lower Case Equivalence
Upper and lower case letters are equivalent. The mnemonic SINGLE has the same semantic meaning as the mnemonic single.
<white space>
<white space> is defined to be one or more characters from the ASCII set of 0 – 32 decimal, excluding 10 decimal (NL). <white space> is used by several instrument listening components of the syntax. It is usually optional, and can be used to increase the readability of a program.
Suffix Multiplier The suffix multipliers that the instrument will accept are shown in table 6-1. They are used in conjunction with suffix units, shown in table 6-2.
Table 6-1
<suffix mult>
Value Mnemonic
1E18 EX 1E15 PE 1E12 T 1E9 G 1E6 MA 1E3 K 1E-3 M 1E-6 U 1E-9 N 1E-12 P 1E-15 F 1E-18 A
6–9
Message Commun ication and System Functions
Syntax Overview
Suffix Unit The suffix units that the instrument will accept are shown in table 6-2.
Table 6-2
<suffix unit>
Suffix Referenced Unit
V Volt S Second
Example To specify 3 ns, you might enter 3NS or 3E-9 S in your program.
6–10
7

Status Reporting

Introduction
Status reporting allows you to use information about the instrument in your programs, so that you have better control of the measurement process. For example, you can use status reporting to determine when a measurement is complete, thus controlling your program, so that it does not get ahead of the instrument. This chapter describes the status registers, status bytes and status bits defined by IEEE
488.2 and discusses how they are implemented in the HP 16500C Logic Analysis System. Also in this chapter is a sample set of steps you might use to perform a serial poll over HP-IB.
The status reporting features available over the bus are the serial and parallel polls. IEEE 488.2 defines data structures, commands, and common bit definitions. 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. For registers, the summary bit is set if any enabled bit in the event register is set. The events are enabled via the corresponding event enable register. Events captured by an event register remain set until the register is read or cleared. Registers are read with their associated commands. The event registers and all queues except the output queue. If sent immediately following a program message terminator, the output queue will also be cleared.
*CLS command clears all
*CLS is
7–2
Figure 7-1
Status Repor ting
Status Byte Structures and Concepts
7–3
Status Reporting

Event Status Register

Event Status Register
The Event Status Register is an IEEE 488.2 defined register. The bits in this register are "latched." That is, once an event happens which sets a bit, that bit will only be cleared if the register is read.

Service Request Enable Register

The Service Request Enable Register is an 8-bit register. Each bit enables the corresponding bit in the status byte to cause a service request. The sixth bit does not logically exist and is always returned as a zero. To read and write to this register, use the *SRE? and *SRE commands.

Bit Definitions

The following mnemonics are used in figure 7-1 and in chapter 9, "Common Commands:"
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. This bit is returned for the *STB? query.
RQS - request service
Indicates if the device is requesting service. This bit is returned during a serial poll. RQS will be set to 0 after being read via a serial poll (MSS is not reset by *STB?).
7–4
Status Repor ting
Bit Definitions
MSG - message
Indicates whether there is a message in the message queue (Not implemented in the HP 16500C Logic Analysis System).
PON - power on
Indicates power has been turned on.
URQ - user request
Always returns a 0 from the HP 16500C Logic Analysis System.
CME - command error
Indicates whether the parser detected an error.
EXE - execution error
Indicates whether a parameter was out of range, or inconsistent with current settings.
DDE - device specific error
Indicates whether the device was unable to complete an operation for device dependent reasons.
QYE - query error
Indicates whether the protocol for queries has been violated.
The error numbers and strings for CME, EXE, DDE, and QYE can be read from a device-defined queue (which is not part of IEEE 488.2) with the query :SYSTEM:ERROR? STRING.
RQC - request control
Always returns a 0 from the HP 16500C Logic Analysis System.
OPC - operation complete
Indicates whether the device has completed all pending operations. OPC is controlled by the *OPC common command. Because this command can appear after any other command, it serves as a general-purpose operation complete message generator.
7–5
Status Reporting

Key Features

LCL - remote to local
Indicates whether a remote to local transition has occurred.
MSB - module summary bit
Indicates that an enable event in one of the module Status registers has occurred.
Key Features
A few of the most important features of Status Reporting are listed in the following paragraphs.
Operation Complete
The IEEE 488.2 structure provides one technique that can be used to find out if any operation is finished. The *OPC command, when sent to the instrument after the operation of interest, will set the OPC bit in the Standard Event Status Register. If the OPC bit and the RQS bit have been enabled, a service request will be generated. The commands that affect the OPC bit are the overlapped commands.
Example OUTPUT XXX;"*SRE 32 ; *ESE 1" !enables an OPC service
request
Status Byte
The Status Byte contains the basic status information which is sent over the bus in a serial poll. If the device is requesting service (RQS set), and the controller serial-polls the device, the RQS bit is cleared. The MSS (Master Summary Status) bit (read with *STB?) ) and other bits of the Status Byte are not be cleared by reading them. Only the RQS bit is cleared when read.
The Status Byte is cleared with the *CLS common command.
7–6
Figure 7-2
Status Repor ting
Key Fe atures
Service Request Enabling
7–7
Status Reporting

Serial Poll

Serial Poll
The HP 16500C Logic Analysis System supports the IEEE 488.1 serial poll feature. When a serial poll of the instrument is requested, the RQS bit is returned on bit 6 of the status byte.
Using Serial Poll (HP-IB)
This example will show how to use the service request by conducting a serial poll of all instruments on the HP-IB bus. In this example, assume that there are two instruments on the bus: the Logic Analysis System at address 7 and a printer at address 1.
The program command for serial poll using HP BASIC 6.2 is Stat = SPOLL(707). The address 707 is the address of the Logic Analysis System in the this example. The command for checking the printer is Stat = SPOLL(701) because the address of that instrument is 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).
The serial poll operation can be conducted in the following manner:
1 Enable interrupts on the bus.
This allows the controller to see the SRQ line.
2 Disable interrupts on the bus.
3 If the SRQ line is high (some instrument is requesting service) then
check the instrument at address 1 to see if bit 6 of its status register is high.
4 To check whether bit 6 of an instruments status register is high, use
the BASIC statement IF BIT (Stat, 6) THEN
5 If bit 6 of the instrument at address 1 is not high, then check the
instrument at address 7 to see if bit 6 of its status register is high.
6 As soon as the instrument with status bit 6 high is found check the
rest of the status bits to determine what is required.
The SPOLL(707) command causes much more to happen 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, and reads the data. For more information about serial poll, refer to your controller manual and programming language reference manuals.
7–8
Status Repor ting

Parallel Poll

After the serial poll is completed, the RQS bit in the Status Byte Register of the HP 16500C Logic Analysis System will be reset if it was set. Once a bit in the Status Byte Register is set, it will remain set until the status is cleared with a *CLS command, or the instrument is reset.
Parallel Poll
Parallel poll is a controller-initiated operation which is used to obtain information from several devices simultaneously. When a controller initiates a Parallel Poll, each device returns a Status Bit via one of the DIO data lines. Device DIO assignments are made by the controller using the PPC (Parallel Poll Configure) sequence. Devices respond either individually, each on a separate DIO line; collectively on a single DIO line; or any combination of these two ways. When responding collectively, the result is a logical AND (True High) or logical OR (True Low) of the groups of status bits.
Figure 7-3 shows the Parallel Poll Data Structure. The summary bit is sent in response to a Parallel Poll. This summary bit is the "IST" (individual status) local message.
The Parallel Poll Enable Register determines which events are summarized in the IST. The *PRE command is used to write to the enable register and the *PRE? query is used to read the register. The *IST? query can be used to read the IST without doing a parallel poll.
7–9
Figure 7-3
Status Reporting
Parallel Poll
Parallel Poll Data Structure
7–10
Loading...