Agilent 8712ET User’s Handbook Supplement

HP Instrument BASIC User’s Handbook
Supplement
HP 8712ET/ES and HP 8714ET/ES
RF Network Analyzers
HP Part No. 08714-90019
Printed in USA
Print Date: October 1998
© Copyright 1998 Hewlett-Packard Company
Notice
The information contained in this document is subject to change without notice.
Hewlett-Packard makes no warranty of any kind with regard to this material, including but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material.
Firmware Revision
This manual documents analyzers with firmware revisions E.06.00 and above.
Contents
1. Introduction
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Overview of HP Instrument BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Using HP Instrument BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Allocating Internal Memory for IBASIC Use. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Typographical Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
2. Recording Programs
Keystroke Recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
What Is Keystroke Recording?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
IBASIC Programs and the Input Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
What's in a Recorded Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
The OUTPUT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
The ASSIGN Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
SCPI Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
How Recording Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-8
Operations that Do Not Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Front Panel Operations without Mnemonics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
HP Instrument BASIC Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Operations Requiring Additional Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Mnemonics with No Corresponding Front Panel Operation . . . . . . . . . . . . . . . . . . 2-12
Avoiding Recording Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Use Instrument Preset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Specifically Select Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Use HP-IB Echo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14
3. Running, Pausing, and Stopping Programs
Starting Programs Automatically. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Running and Continuing a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Pausing and Continuing a Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Using LOCAL LOCKOUT 8 to Disable the Pause Key . . . . . . . . . . . . . . . . . . . . . . . 3-7
Stopping a Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
i
Contents
4. Saving and Recalling Programs
Selecting a Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-3
Saving a Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4
AUTOST Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-6
Recalling a Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7
CAT to a String Array Exception. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-8
5. Developing Programs
External Editors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3
HP BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3
ASCII Word Processors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-4
Programming Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-4
Editing Your Program Using Edit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-5
The IBASIC Editor Softkeys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-6
Recording into an Existing Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-7
Editing with an External Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-8
Entering Program Lines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-11
Editing from the Front Panel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-12
Removing Program Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-14
Renumbering, Copying, Moving, and Indenting Lines . . . . . . . . . . . . . . . . . . . . . . .5-16
Using IBASIC Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-17
Using UTILITIES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-20
6. Debugging Programs
Setting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-3
Examining Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-4
Examining Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-5
Examining Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-5
Displaying the Last Error Encountered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6-6
7. Graphics and Display Techniques
Display Partitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-2
Using the Display Partitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-3
Allocating Display Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-4
De-Allocating Display Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-5
Operation with No Display Partition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-5
ii
Contents
Displaying Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-7
Getting Text to the Screen Quickly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Pop-Up Message Windows and Custom Annotations. . . . . . . . . . . . . . . . . . . . . . . . . 7-9
Graphics Initialization and Scaling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
Using Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
Drawing Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
Graphics Exceptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
Labeling with Different Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
SCPI Graphics Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15
For More Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17
8. Interfacing with External Devices
Communication with Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
HP-IB Device Selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3
Moving Data through the HP-IB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
General Structure of the HP-IB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-5
Using the Serial and Parallel Ports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
Using the Analyzer Ports in IBASIC Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
General Bus Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-9
REMOTE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10
LOCAL LOCKOUT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10
LOCAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
TRIGGER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
CLEAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12
ABORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12
HP-IB Service Requests. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-13
Passing and Regaining Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17
The IBASIC HP-IB Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
The External Bus and the Internal Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
Service Request Indicators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18
IBASIC as the Active Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Passing Active Control to the Instrument. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-20
IBASIC as a Non-Active Controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-21
Interfacing with an External Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-22
Synchronizing IBASIC with an External Controller . . . . . . . . . . . . . . . . . . . . . . . . 8-23
Transferring Data between Programs Using OUTPUT and ENTER Statements . 8-25
iii
Contents
Transferring Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-27
IBASIC Communication across the LAN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-29
9. Using Subprograms
User-Created Subprograms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-2
Built-In High-Speed Subprograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-3
Avoiding Multiple Loads of Subprograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-9
10. IBASIC Keyword Summary
Keywords in Alphabetic Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-3
Keywords in Category Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10-14
iv

1 Introduction

1-1

Introduction

Introduction
Introduction
This manual describes how to create and use HP Instrument BASIC (IBASIC) software in the analyzer. It demonstrates how to use IBASIC's programming, editing and debugging features. It also describes how to save and recall programs and how certain instrument-specific IBASIC features are implemented in the analyzer. The reader should be familiar with the operation of the analyzer and BASIC before programming the analyzer.Related information can be found in the following references that were shipped with your analyzer:
• The Programmer’s Guide, a companion to this book, provides general-purpose programming information. The Programmer’s Guide describes all valid instrument commands.
• The User’s Guide provides information on making measurements with the analyzer.
• The HP Instrument BASIC User’s Handbook provides information on HP Instrument BASIC (IBASIC) .
• The Example Programs Disk — DOS format: part number 08714-10003, is included with the analyzer. This disk provides copies of all of the example programs in the Example Programs Guide.
• Additional information on HP BASIC programming is available in the manual set for the BASIC revision being used. For example: BASIC
7.0 Programming Techniques and BASIC 7.0 Language Reference.
Other information that may be helpful can be found in the following reference materials:
• The Tutorial Description of the Hewlett-Packard Interface Bus (HP literature no. 5021-1927) provides information on using the HP-IB.
Contact the nearest HP sales office for ordering information. A list of HP sales and service offices can be found in the “Specifications and Characteristics” chapter of the User’s Guide.

Overview of HP Instrument BASIC

HP-IB
Overview of HP Instrument BASIC
HP Instrument BASIC (IBASIC) can be used for a wide range of applications, from simple recording and playback of measurement sequences to remote control of other instruments. IBASIC is a complete language with over 200 keywords.
IBASIC is a complete system controller residing inside your analyzer. It communicates with the analyzer via HP-IB commands over an internal interface bus (select code 8). It can also communicate with other instruments, computers, and peripherals using the external HP-IB interface (select code 7) or the serial (select code 9) or parallel (select code
15) I/O ports.
NOTE The analyzer can also be controlled by an external controller.
It has a factory default external HP-IB address of 16. When using IBASIC to control other instruments, no other device should use the same address.The external HP-IB address can be changed using either the front panel keys under the , menu, or the SCPI mnemonic SYST:COMM:GPIB:ADDR.
SYSTEM OPTIONS
Introduction
HP IBASIC Supplement 1-3
Introduction

Using HP Instrument BASIC

Using HP Instrument BASIC
Y ou need not be proficient in a programming language to successfully use IBASIC. In keystroke recording mode, IBASIC automatically builds an executable program by capturing measurement sequences as they are performed. With little or no editing of these program lines, you can immediately put your program to work to control and automate your analyzer.
The IBASIC language is a subset of the HP BASIC language. In fact, IBASIC programs can be run on any HP BASIC workstation with very few changes. When an external PC keyboard (with a DIN connector) is connected to the analyzer, the IBASIC user interface emulates the user interface of the HP BASIC. The PC keyboard can be used for command entry, editing and program inputs.
You can use IBASIC to do the following:
• create on screen graphics
• control other instruments and peripherals
• create interactive prompts
• simplify keystrokes with the key
• create programs by recording keystrokes
• run applications
IBASIC also works in conjunction with an external controller which can download and run programs, query variables and respond to service requests (SRQs).
BEGIN

Allocating Internal Memory for IBASIC Use

Select Disk
Configure VOL_RAM
Modify Size
Modify Size
Allocating Internal Memory for IBASIC Use
Your analyzer contains a volatile RAM disk that is configured for use with IBASIC. The default condition set at the factory allocates most of this disk's memory for IBASIC use. To see what the current allocations are for this disk, press
display that shows total memory available, and how the memory is currently allocated.
To change the allocations, use the softkey. The number you enter with the softkey, is the percentage of memory that will be used for normal disk functions (such as storing instrument states). The remainder will be allocated for use with IBASIC.
NOTE Cycle power after changing the allocations.
You must cycle the power on the analyzer for new allocations to take effect.
SAVE RECALL
. A message will appear on the analyzer's
Introduction
HP IBASIC Supplement 1-5
Introduction
Softkey
Softkey ON off
Softkey 1
Softkey 2

Typographical Conventions

Typographical Conventions
The following conventions are used in this manual when referring to various parts of the HP Instrument BASIC and analyzer operation environments:
HARDKEY
HARDKEY
<element> Angle brackets are used to signify a syntax element in a statement. computer font User input and computer output is shown with a mono-spaced font.
The name of a hardkey on the front panel of the analyzer. This notation is also used to represent keys on an external keyboard connected to the analyzer's DIN interface.
The label of a softkey. Upper case selection in a softkey indicates the state after the
softkey is pressed. A series of hardkeys and softkeys represents the path to a given
softkey or menu.

2 Recording Programs

2-1
Recording Programs
Keystroke recording, described in this chapter, is ideal for creating simple programs or measurement sequences for instrument control. Other methods of program development may be used to supplement keystroke recording and create more sophisticated programs. If a program requires data processing, decision making, operator input, or a display of graphical diagrams, other program development methods are needed. These methods are covered in Chapter 5, “Developing Programs.”
IBASIC programs for the analyzer can be created and edited using the following methods:
• the front panel keys and knob
• an external keyboard (Option 1CL)
• an HP controller running HP BASIC
• a workstation or PC using a text editor or programming editor
Recording Programs
IBASIC
Key Record on OFF
IBASIC
Key Record on OFF
Run
IBASIC

Keystroke Recording

Keystroke Recording
Keystroke recording is the easiest way to create IBASIC programs. It requires only a couple of steps to set up and run, and very little programming knowledge is required.

What Is Keystroke Recording?

Keystroke recording is a way to automatically create IBASIC measurement sequence programs. To record a program, press the following keys:
SYSTEM OPTIONS
• Normal key sequences for the measurement
• to
SYSTEM OPTIONS
terminate recording
The resulting program can then be run by pressing in the
SYSTEM OPTIONS
menu.
Keystroke recording works by finding the SCPI mnemonic that fits each operation performed by the instrument; then it builds a program line to perform that operation when the recorded program is executed. All program lines built by keystroke recording are entered into the analyzer's program buffer. If the buffer contains no existing lines, a complete executable program will be created. If there is a program in the buffer when recording is turned on, the recorded statements are inserted into the existing program. Refer to Chapter 5, “Developing Programs,” for a description of how to record into existing programs.
HP IBASIC Supplement 2-3
Recording Programs
Keystroke Recording

IBASIC Programs and the Input Buffer

Recorded programs send commands to the instrument, and use the same set of commands used by external controllers for remote operation of the instrument.
These commands are stored in an input buffer by the instrument. An IBASIC program generally outputs the commands much faster than the instrument can execute them. This often causes the program to complete while the instrument is still executing commands in the input buffer . The instrument continues processing these commands until the buffer is empty.
This may have some side-effects if you are not aware of this interaction. For example, it may not be immediately obvious that the program has actually finished, since the instrument is still functioning “remotely.” This could cause confusion if you try to pause and continue a program that has actually ended.
You can clear the buffer from within your program by inserting the statement CLEAR 8 at the beginning of your program (see Chapter 5 for information on editing programs).
Another side-effect of the speed with which the analyzer processes commands is that it is possible for a command to execute before a previous command has completed execution. The most common example of this is a data query that executes before a measurement sweep is complete. This interaction can lead to erroneous data being collected. F or more information on synchronizing the execution of commands, refer to “Synchronizing the Analyzer and a Controller” in the Programmer's Guide.
Recording Programs

What's in a Recorded Program

What's in a Recorded Program
A program created using keystroke recording is composed of three fundamental IBASIC statements: ASSIGN, OUTPUT and END. The following simple program demonstrates these statements:
1 ASSIGN @Rfna TO 800 2 OUTPUT @Rfna;”SOUR1:POW -10 dBm” 10 END
The ASSIGN and END statements are automatically created when keystroke recording is used to create a new program (as opposed to modifying an existing one).
There will only be one ASSIGN statement at the beginning of a program and one END statement at the end, but in a typical program there will be many OUTPUT statements. Since the OUTPUT statement does the actual work of controlling the analyzer, let's take a closer look at how it is used.
NOTE Each analyzer model requires a unique ASSIGN statement.
The ASSIGN statement, which is automatically created, will vary depending on the model of the analyzer:
HP 8712ES/ET ASSIGN @Hp8712 To 800 HP 8714ES/ET ASSIGN @Hp8714 TO 800
HP IBASIC Supplement 2-5
Recording Programs
What's in a Recorded Program

The OUTPUT Statement

The IBASIC statement
OUTPUT <destination>;<data>
tells the internal computer to send some information(data) to a device at a specific address(destination). The destination can be a device selector number (example: OUTPUT 800), or a name representing a number, called a path name (example: OUTPUT@Rfna). In recorded IBASIC programs, the data are strings containing commands for the instrument (mnemonics).
The following represents a typical OUTPUT command from a recording session:
OUTPUT @Rfna;”SOUR1:POW -10 dBm”
Notice that the OUTPUT command is followed by a name representing a device selector (@Rfna), followed by a semicolon and the data (SOUR1:POW -10 dBm).

The ASSIGN Statement

The destination in an OUTPUT statement specifies the address of the device. In recorded programs this address is represented by the I/O path name @Rfna. The following line appears in all recorded programs before any OUTPUT statements:
ASSIGN @Rfna to 800
The ASSIGN statement allows you to substitute an I/O path name (a variable preceded by the @ symbol) for a device selector number. Therefore, after the above ASSIGN statement, the program line
OUTPUT @Rfna;”SOUR1:POW -10 dBm”
is equivalent to
OUTPUT 800;”SOUR1:POW -10 dBm”
The device selector 800 specifies the host instrument as the destination of any data sent by the OUTPUT command. The program communicates with the analyzer via select code 8, the internal HP-IB interface, which is
used only for communication between IBASIC programs and the analyzer. The analyzer will respond to any address on the internal interface from 800 to 899 (800 is typically used).

SCPI Mnemonics

The data sent to the analyzer by the OUTPUT command is called a SCPI (Standard Commands for Programmable Instruments) mnemonic and is found in quotes following the device selector path name and semicolon. See Figure 2-1.
Figure 2-1 Example IBASIC OUTPUT Command Syntax
OUTPUT @Rfna;"SOUR1:POW -10 dBm”
Recording Programs
What's in a Recorded Program
IBASIC command
IBASIC variable: Holds device selector path name (analyzer address)
SCPI is a standard instrument control programming language that provides commands that are common from one product to another, thus reducing the number of device specific commands. It uses easy-to-learn, self-explanatory syntax that provides flexibility for both novice and expert programmers.
The SCPI mnemonic codes used by IBASIC are the same ones used to control the instrument remotely via an external computer. External computers communicate with the analyzer over the external HP-IB bus while IBASIC programs communicate with it over the internal bus. In our example, the mnemonic “SOUR1:POW -10 dBm” tells the instrument to set the source power to 10 dBm.
For more information on HP-IB interfacing using IBASIC, refer to
Chapter 8, “Interfacing with External Devices.” The SCPI mnemonics for
the analyzer are documented in the Programmer's Guide.
Delimiter: Separates IBASIC command from SCPI mnemonic
SCPI mnemonic (command)
HP IBASIC Supplement 2-7
Recording Programs
Level
2
Enter

How Recording Works

How Recording Works
Keystroke recording works by recording the functional operation of the instrument, not by recording every keystroke. A sequence of SCPI mnemonics forms the recorded sequence of operations.
As you press a sequence of keys to perform an operation, SCPI mnemonics for that operation are generated and recorded. The operation may take one keystroke or several keystrokes, but the mnemonic is not generated until the operation is complete.
In other words, it is the functional operation of the instrument that is recorded as a mnemonic. The separate, individual keystrokes to perform that operation are not recorded.
For example , recording the simple key sequence:
1 0
mnemonic that is generated after the keystroke sequence is completed:
“SOUR1:POW -10dBm”
This mnemonic is then automatically formed into the command
OUTPUT @Rfna;”SOUR1:POW -10 dBm”
and is inserted into the program. If you accidentally press an incorrect key in a sequence, it may not show
up in the recorded program. Also, you cannot exactly mimic keystrokes to leave the instrument in a specific front panel state, unless this state appears as a natural consequence of a completed operation.
As shown in the above example, pressing the hardkey in a recording session has the effect of bringing up the menu, but does not, by itself, generate a program line. You could not, therefore, leave the instrument with the menu displayed.
requires six keystrokes and produces a single
POWER
POWER
POWER
POWER
Recording Programs
IBASIC

Operations that Do Not Record

Operations that Do Not Record
Although keystroke recording works automatically in most situations, some operations cannot be captured or can only be partially captured using this method. This is true for one of the following reasons:
• There is no corresponding SCPI mnemonic for the front panel keystrokes (such as transitional key sequences).
• The keystrokes are IBASIC front panel operations (such as some of the softkey operations found under the
menu).
• The operation requires additional programming steps (such as passing control of the HP-IB to the instrument for hardcopy output).
• The HP-IB operation has no front panel equivalent (such as HP-IB query commands or data transfer).
• The keystrokes are service menu keys (in general).
SYSTEM OPTIONS
NOTE Do not recall programs in keystroke record mode.
This will overwrite previously recorded program steps.

Front Panel Operations without Mnemonics

The following descriptions indicate areas of front panel operation which have no corresponding SCPI mnemonics:
• Most operations on the front panel requiring numeric entry allow use of the knob to increment or decrement the current value. This will not record as a program line. Always use the numeric keypad or step keys
to enter any value if you want the operation to be recorded.
• During a measurement sequence, it may take several key presses to cause an operation that will generate a mnemonic. The transitional sequences between actual instrument events are not recordable. For example, pressing the key displays the scale numeric entry, but nothing is recorded until you enter a value for the scale parameter.
HP IBASIC Supplement 2-9
SCALE
Recording Programs
IBASIC
Run
Continue
Edit
Programs
Operations that Do Not Record
• Any default states which you set up prior to recording or which you encounter while recording (and consequently do not select) are not recorded.
• Use of step keys is not recommended because the results may depend on the function's step size, which may change as other parameters change.
NOTE Instrument states that are not specifically selected or changed are not
recorded. Since these default states are not recorded, you must either actively select them to generate a program statement, or make sure the instrument is in exactly the same state when the program is run as when it was recorded. This is discussed further in “A voiding Recording Errors” later in this chapter.

HP Instrument BASIC Operations

Some softkeys under the menu cannot be recorded. Operations on programs, such as , ,
and , do not record. You can,
SAVE RECALL
however, record display partitions and all other save and recall operations not having to do with IBASIC programs.
Although IBASIC operations cannot be recorded, many do have corresponding SCPI mnemonics that allow an external controller to control and communicate with internal IBASIC programs. For more information, refer to Chapter 8, “Interfacing with External Devices.”
SYSTEM OPTIONS

Operations Requiring Additional Programming

Some operations that work well when performed manually from the front panel require special attention when used in a program. This is due to two interactions: synchronization and active control.
Recording Programs
Start
Abort
Operations that Do Not Record
Synchronization
Often, one event must be completed before another can occur. Suppose you want your program to perform a limit test on data, but only after a sweep has been completed. You can record the command to perform the limit test by pressing key sequences. However, to detect when the instrument has completed a sweep, you must edit the program and include a routine that waits for a status register to indicate the end of the sweep.
CAUTION Synchronization is required only with overlapped commands.
Overlapped commands, such as the command to trigger a sweep, don't hold off the processing of subsequent commands, and are not necessarily completed when the next command begins. The analyzer adds a “wait” command (*WAI) when an overlapped command is created using keystroke recording. *WAI delays processing of subsequent commands until previous commands have been parsed. *WAI does not insure previous commands have completed. For more information on synchronization, see “Synchronizing the Analyzer and a Controller” in the Programmer's Guide.
Active Control of the HP-IB Interface
Some operations require the analyzer to be the active controller on the external HP-IB bus. The analyzer must be the System Controller (or active control must be passed to it from an external controller). When an IBASIC program begins running, control of the external interface is automatically passed to the program, so active control must be passed back to the analyzer before these operations can be performed.
These operations include all of the following actions when they are directed to HP-IB devices.
HARDCOPY
HARDCOPY
NOTE Active control of the HP-IB interface is only a problem if that bus is being
used. Hardcopy output to devices on the serial or parallel ports do not require control of the HP-IB.
HP IBASIC Supplement 2-11
Recording Programs
Operations that Do Not Record
The example program “PASSCTRL” in theExample Programs Guide and on the Example Programs Disk illustrates these concepts.
You can use keystroke recording for any of these operations but you will not be able to successfully run the program that is generated. You will need to enter the program lines necessary to first pass control to the analyzer and then wait for control to be passed back to the program.
See “Passing and Regaining Control” in Chapter 8 for an example of passing control to the analyzer.
Mnemonics with No Corresponding Front Panel Operation
Several of the analyzer SCPI mnemonics for the instrument perform operations that are not available from the front panel and cannot be recorded. These include operations such as querying instrument status, transferring data over HP-IB, setting and clearing status registers, and general HP-IB housekeeping.
These operations are useful for the more advanced HP-IB programmer using IBASIC. Because they fall outside the direct operating realm of the analyzer, they cannot be recorded. They can be added to a recorded program using the built-in editor or another editing environment. See your analyzer's Programmer's Guide for a complete description of the analyzer's HP-IB command set. See also “Built-In High Speed Subprograms” in Chapter 9.

Avoiding Recording Errors

Log Mag
Trigger
Hold
Continuous

Use Instrument Preset

Recording Programs
Avoiding Recording Errors
In most cases, the key/operation should be the first keystroke recorded. This sets the instrument to its default state and avoids the risk of creating a program that depends on prior instrument settings.
You can include the command to perform a preset in your program by pressing immediately after turning recording on. This inserts the following line prior to all other OUTPUT statements in your program:
OUTPUT @Rfna;”SYST:PRES;*WAI”
See your analyzer's User's Guide to determine the specific preset state for your particular analyzer.
PRESET
PRESET
Specifically Select Parameters
If you do not want to preset the instrument before running a recorded program (for example, you may be recording a section of a larger measurement sequence), be sure to specifically activate every instrument setting that you will need in your automated sequence. For example, if you want the data format to be Log Mag, press and then , even though Log Mag is already the default setting. This will generate a program line to specifically set the data format to Log Mag.
In some cases you may have to select another setting first and then re-select the original setting in order to generate the correct program line. F or example, if you w ant to generate a program line to set the sweep trigger to Continuous, and you discover that it is already set to Continuous when you start recording, press first—then press . You can easily remove unwanted program lines generated by this procedure in the editor.
MENU
FORMAT
HP IBASIC Supplement 2-13
Recording Programs
HP-IB
HP-IB Echo on OFF
Avoiding Recording Errors
NOTE Do not rely on the step keys or the front panel knob to set parameters.
Use of step keys is not recommended because the results may depend on the function's step size, which may change as other parameters change.

Use HP-IB Echo

HP-IB echo is a useful analyzer feature that allows you to view the SCPI mnemonic or mnemonics corresponding to any operation executed from the front panel. To turn on HP-IB echo, press
and . After doing this, you will see a mnemonic appear in a dialogue box on the screen as you complete any key sequence that has a matching SCPI mnemonic.
This mnemonic is used in your recorded program during a recording session.
Using HP-IB echo, you can preview the SCPI mnemonic commands that will be stored in your program before you actually record them. While this is not essential, it can be very useful when you are in doubt as to what a particular key sequence will record, or precisely when a key sequence corresponding to a mnemonic is completed.
SYSTEM OPTIONS
3 Running, P ausing, and Stopping
Programs
3-1
Running, Pausing, and Stopping Programs
This chapter describes how to start, stop, and pause a program from the front panel. Automatic execution of a program is described.
IBASIC programs can also be remotely controlled via SCPI commands over the HP-IB. For information on running, pausing and stopping programs using an external controller, see Chapter 8, “Interfacing with
External Devices.”
Running, Pausing, and Stopping Programs

Starting Programs Automatically

Starting Programs Automatically
When the analyzer is powered up, it automatically searches for a program named AUTOST or AUTOST.BAS. When an AUTOST program is found, it is automatically loaded and executed. The analyzer searches in the following order:
• internal non-volatile RAM disk
• internal floppy disk drive The AUTOST program can be used for anything from configuring the
analyzer for specific measurements, much like an internal instrument state Save/Recall register, to diagramming measurement setups using graphics commands, as in a guided measurement sequence.
Refer to Chapter 4, “Saving and Recalling Programs,” for information on using the analyzer to name programs before they are saved.
HP IBASIC Supplement 3-3
Running, Pausing, and Stopping Programs
Run
IBASIC
Run
Enter
IBASIC
IBASIC

Running and Continuing a Program

Running and Continuing a Program
To run an IBASIC program that is already in the analyzer program buffer, press the softkey in the menu. The RUN command can also be executed from an external keyboard in three ways:
SYSTEM OPTIONS
• Press the function key that corresponds to the softkey
(see note below).
• Type RUN on a command line and press . A command line is
always available when an IBASIC display is partitioned. (See
Chapter 5, “Developing Programs,” for information about display
partitions.) You can also activate a command line from an external keyboard with no IBASIC displays partitioned by pressing the key on your external keyboard.
• Press the function key when the command line is available.
NOTE The keyboard function keys duplicate softkey actions.
When an external keyboard is connected, the function keys through
always represent the analyzer's eight softkeys. The analyzer's
F8
hardkeys are each represented by a combination of or and one of the function keys. Refer to your analyzer's User's Guide for more information on the external keyboard interface. The
SYSTEM OPTIONS
keyboard using + (for ) and (for
). A keyboard template showing which keys to press for specific analyzer functions is supplied with your analyzer (HP part number 08712-80028).
Ctrl F3 SYSTEM OPTIONS F1
F1
F9
Shift Ctrl
menu can be accessed from an external
ESC
F1
Running, Pausing, and Stopping Programs
Pause
Running and Continuing a Program
The RUN command is executed in two phases: prerun initialization and program execution.
The following occurs during the prerun initialization phase:
• Memory is reserved for variables specified in COM (both labeled and blank), DIM, REAL or INTEGER statements, or implied in the main program segment. Numeric variables are initialized to 0; string variables are initialized to the null string.
NOTE Variables in COM are initialized only once—the first time a program is
run.
• The program is checked for syntax errors that require more than one program line to detect. Included in this are errors such as incorrect array references, and mismatched parameter or COM lines.
After prerun is successfully completed, the program begins the execution phase. Program lines are executed until one of the following events occurs:
1. An END or STOP statement is encountered in the program.
2. The hardkey is pressed to reset the instrument.
3. The softkey is pressed to pause the program.
4. A PAUSE statement is encountered in the program.
HP IBASIC Supplement 3-5
PRESET
Running, Pausing, and Stopping Programs
Pause
Pause
Pause
Pause
Continue
IBASIC

Pausing and Continuing a Program

Pausing and Continuing a Program
The program control softkey menu is always available when an IBASIC program is running. This “Program Running” menu has seven user-defined softkeys and a softkey. Press the softkey to suspend execution of a program. is the eighth softkey and is represented by on an external keyboard.
The program can also be paused by inserting a PAUSE statement in the program. The instrument responds as if you had pressed the softkey. Refer to Chapter 5, “Developing Programs,” to learn how to insert statements in your recorded program. Note that PAUSE is one of the IBASIC keywords included in the editor's label window (also described in Chapter 5).
To continue the program from a paused state, press the softkey in the menu or on an external keyboard. Continuing a paused program resumes program operation from where it was paused, retaining the current program context (variable values, etc.).
F8
SYSTEM OPTIONS
F2
Pausing a program does not close any files that have been opened by the program. You will not be able to perform any of the following disk operations after pausing a program that has left a file open on that medium:
RENAME FILE
DELETE FILE
DELETE ALL FILES
COPY FILES
COPY DISK
FORMAT DISK To close all open files , you must complete the execution of the program or
perform an IBASIC RESET. This can be done by pressing the hardkey. The hardkey is represented by + on an external keyboard. Keystroke recorded programs do not open files and therefore avoid this problem.
PRESET Ctrl F4
PRESET
Running, Pausing, and Stopping Programs
Pause
Pause
Pause
Pausing and Continuing a Program

Using LOCAL LOCKOUT 8 to Disable the Pause Key

The key is always enabled when a program is first run and remains enabled until a LOCAL LOCKOUT 8 command is executed.
Example 1. key locked-out from within a program.
10 ! 20 LOCAL LOCKOUT 8 30 ! 40 ...
Example 2. The key can be re-enabled from within the program with the LOCAL 8 command at any time.
90 ! 100 Re-enable_pause: 110 LOCAL 8 120 RETURN 130 !
The key can still be used to stop a program even if the LOCAL
PRESET
LOCKOUT 8 command has been executed.
HP IBASIC Supplement 3-7
Running, Pausing, and Stopping Programs
IBASIC
Utilities
Clear Program

Stopping a Program

Stopping a Program
To stop a program completely, press the hardkey at any time while the program is running. This causes an IBASIC RESET. Placing a STOP statement in your program will also terminate the program, but does not perform an IBASIC RESET operation. The END statement can also be used to stop program execution, but it must be the last line in the main program segment.
The program remains in the program buffer after execution stops. To clear the program buffer, press
For more information on the PAUSE and STOP statements, see the “HP Instrument BASIC Language Reference” section of the HP Instrument BASIC User’s Handbook.
SYSTEM OPTIONS
or turn off the instrument.
PRESET

4 Saving and Recalling Programs

4-1
Saving and Recalling Programs
IBASIC programs are stored in memory, on disk, or in an external computer.
To transfer a program between the instrument's buffer and a disk mass storage device, use the Programs menu. To access the Programs menu using an external keyboard, use Ctrl + F1 (for ) and F5 (for Programs).
The GET, SAVE, LOAD, STORE, RE-STORE, and RE-SAVE commands can be used within a program or from an IBASIC command line to transfer program files to and from mass storage. An autoload feature also exists to allow for a program (named AUTOST or AUTOST.BAS) to be automatically recalled from the internal non-volatile RAM disk or the built-in floppy disk and run at power-up.
Using an external controller, such as an HP Series 200/300/700 workstation, you can combine the convenience of keystroke recording in IBASIC with the ease of program editing on a dedicated external workstation. Record the measurement sequence and transfer the program to the workstation for further editing. In addition, fully developed programs may be transferred from an external controller to the analyzer. Transferring programs between the analyzer and an external computer is described in detail in Chapter 8, “Interfacing with
External Devices.”
SAVE RECALL
This chapter describes all program transfer operations between the program buffer and the analyzer's internal non-volatile RAM disk, internal volatile RAM disk, and internal floppy disk drive.

Selecting a Disk

Programs
Non-Vol RAM Disk
Volatile RAM Disk
Internal 3.5” Disk
Select Disk
Saving and Recalling Programs
Selecting a Disk
When the menu is selected, the analyzer automatically catalogs the selected disk or memory. The selected disk is one of the following mass storage devices:
•Internal Non-Volatile RAM Disk
•Internal Volatile RAM Disk
•Internal Floppy Disk Drive To select a mass storage device, press the softkey in the
SAVE RECALL
choice.
SAVE RECALL
menu. Then press the key corresponding to your
HP IBASIC Supplement 4-3
Saving and Recalling Programs
Save Program
Programs
File Type
Save Program
Programs
Re-Save Program
Re-Save Program
Re-Save Program

Saving a Program

Saving a Program
To save the current contents of the analyzer's program buffer to a file, press in the menu. Specify the type of file with the softkey. The default choice is ASCII. The program is saved to an ASCII file with a default name on the currently selected mass storage device or disk. Each time the
key is used a new file is created. These files are named PROG0.BAS, PROG1.BAS,… with the number incrementing for each new file. F or portability, save files in ASCII. See “User-Created Subprograms” in Chapter 9 for when it is necessary to save files in binary format.
Figure 4-1 The SAVE RECALL Screen
SAVE RECALL
If you are re-saving a program — that is, saving a file to a disk that already contains the file name — press and use the arrow keys to highlight the name of the file to be re-saved. Then press
and the file is saved. The disk is automatically
catalogued when the menu is selected. The softkey can also be used to save a new
program with a non-default file name. Press . Enter the new program's name using the external keyboard or the internal label maker. If no file with that name exists on the disk, a new file is created.
SAVE RECALL
Saving and Recalling Programs
Saving a Program
NOTE Whenever possible use ASCII as the file type for the following reasons:
• ASCII format is faster.
• Binary format is not compatible from one model of analyzer to another.
• HP BASIC cannot read a binary file from the analyzer.
HP IBASIC Supplement 4-5
Saving and Recalling Programs
Programs
Save AUTOST
Re-Save Program

AUTOST Programs

AUTOST Programs
IBASIC allows you to designate a program to be automatically loaded and run when the instrument is first powered up. To make an autoloading program, save it with the file name AUTOST on the internal floppy disk drive or internal non-volatile RAM disk. This can be done from the menu by pressing
entering the file name AUTOST. When the analyzer is powered up, it automatically searches the internal
non-volatile RAM disk and then the built-in floppy disk drive for a program named AUTOST or AUTOST.BAS. When an AUTOST program is found, it is automatically loaded and executed.
SAVE RECALL
or by using the softkey and
Saving and Recalling Programs
Programs
Recall Program
IBASIC
IBASIC Display
Programs

Recalling a Program

To recall a program file from mass storage to the program buffer, use the
SAVE RECALL
desired mass storage device or disk, use the arrow keys to highlight the file and press .
The recalled program file is entered into the program buffer one line at a time and checked for syntax errors. Lines with syntax errors are commented out and the IBASIC syntax error is displayed briefly in an error message and written to the CRT at the same time. To view error messages logged to the CRT, use the
menu to allocate a screen partition for IBASIC.
NOTE Recalled programs overwrite the current program.
Any program recalled to the program buffer using the menu will overwrite the current contents of the program buffer. Be sure to save your current program before recalling another program from disk.
menu to catalog the disk. Select the
SYSTEM OPTIONS
Recalling a Program
HP IBASIC Supplement 4-7
Saving and Recalling Programs

CAT to a String Array Exception

CAT to a String Array Exception
The analyzer's treatment of CAT to a string array is not the standard as documented in the HP IBASIC Language Reference. If you send the catalog to a string array, the array must contain at least 59 characters for a directory listing rather than the standard 80.

5 Developing Programs

5-1
Developing Programs
IBASIC
Edit
IBASIC Display
Utilities
Edit
IBASIC Display
Utilities
For many applications, keystroke recording alone is sufficient to create and run programs. However, with some knowledge of the IBASIC language and the program development capabilities of the analyzer, you can significantly increase the power of your recorded programs or create your own original programs.
This chapter describes the operation of the following keys in the
SYSTEM OPTIONS
underlying menus:
• starts the editor. You can make changes to your program on a
line-by-line basis, or create a new program. The menu allows you to select the part of the CRT
display available for use by IBASIC. An IBASIC display partition provides you with a place to enter IBASIC commands from an external keyboard. It also provides an area for viewing graphics and program output.
menu, and any softkeys found in their
allows you to clear programs from the program buffer,
allocate memory for program use, or secure program lines.
Developing Programs

External Editors

External Editors
In addition to the built-in IBASIC editor, programs can be developed in the following external environments:
• HP BASIC editors
• ASCII word processors
• programming editors These external editing environments provide many advantages, the most
notable are improved speed and flexibility. Precautions must be taken when using ASCII word processors because they do not provide the syntax checking available when using the internal editor.
After editing a program in an external environment, the best practice is to GET the program from an IBASIC command line using the following procedure (instead of using the keys described in Chapter 4, “Saving and Recalling Programs,”).
1. Partition an IBASIC display (as described later in this chapter).
SAVE RECALL
2. Use an external keyboard to enter the command GET “PROG0:,4” (this command loads a program file PROG0 from the internal floppy disk drive).
3. Watch the IBASIC display as the program is loaded — syntax errors result in error messages which are displayed on the screen.
4. Edit the program to correct any errors found.

HP BASIC

The HP BASIC editor checks for the syntax of the version of HP BASIC being used. Because IBASIC is a subset of HP BASIC , it ma y not find all of the errors — the most common error is the use of HP BASIC commands that are not supported by IBASIC. For a listing of the commands supported by IBASIC, refer to Chapter 10, “IB ASIC Keyword Summary.”
HP IBASIC Supplement 5-3
Developing Programs
External Editors

ASCII Word Processors

When an ASCII word processor is used to edit a program, syntax checking does not occur until the program is loaded by the instrument. Also, program line numbers are not automatically renumbered when new lines are inserted.
It is recommended that you renumber the program, as described later in this chapter , to reduce the possibility of errors . Errors in numbering lines usually do not result in a syntax error; they write over other program lines.

Programming Editors

Editors designed for computer programming offer some advantages:
• methods to visually distinguish language elements with color or other type style
• complex search-and-replace utilities
These editors are available as part of some programming language products and as individual products.
Developing Programs
Edit
IBASIC

Editing Your Program Using Edit

Editing Your Program Using Edit
The built-in editor may be used for creating and altering lines in an IBASIC program. Those familiar with the editor found in HP BASIC will find it similar to the instrument's IBASIC editor. It is easy to learn and use.
To start the editor, press the softkey in the
menu or on an external keyboard. You will see the program appear on the display with a cursor on the first line of the program, as shown in Figure 5-1. If the program buffer is empty, the first line number 10 appears with the cursor positioned to begin entering text.
Figure 5-1 The HP IBASIC Program Editor
F4
SYSTEM OPTIONS
HP IBASIC Supplement 5-5
Developing Programs
Prior Menu
IBASIC
IBASIC
Edit
Insert Line
Insert Char
Delete Line
Recall Line
Delete Char
Editing Your Program Using Edit
The analyzer editor is accompanied by a “Label Window” at the top of the screen. This window is filled with characters and IBASIC keyword commands and has its own cursor.
The current program line (the line containing the cursor) always appears as two lines on the screen, allowing you to enter up to 108 characters if needed. All other lines have only their first 51 characters displayed (excluding line numbers).
Each line has a numeric field in the first 6 columns in which program line numbers are right justified. Although program lines are automatically numbered by the editor, you can edit the current line number to copy or move it to a different location in the program. The range of line numbers is from 1 to 32767. To end an editing session, press the softkey in the edit menu or on an external keyboard. This will return you to the menu.
SYSTEM OPTIONS
F8

The IBASIC Editor Softkeys

The editor has two sets of softkey menus, the Edit keys and the Character Entry keys. The edit menu is activated when you press
SYSTEM OPTIONS
softkeys shows the label Edit. The edit menu provides the following softkeys:
. The menu box above the
()
F1
()
F2
()
F3
()
F4
()
F5
Developing Programs
Enter
Prior Menu
IBASIC
Edit
Prior Menu
Key Record on OFF
IBASIC
Key Record on OFF
Insert Line
Editing Your Program Using Edit
()
F6
()
F7
()
F8
The character entry menu is described in the “Editing from the Front Panel” section of this chapter.

Recording into an Existing Program

One way to enter lines into your program is to use the keystroke recording capabilities of IBASIC. To record measurement sequences or other front panel operations into your program, follow the procedure described below.
1. Activate the editor by pressing
.
2. Use the step keys on the analyzer or the cursor keypad on an external
keyboard to position the cursor on the line above where you want to insert the recorded statements.
3. Press to exit the editor.
4. Press to activate keystroke recording.
5. Record the measurement sequence or front panel operation.
6. Press to conclude the recording
session.
The inserted recording acts the same as if you had pressed in the editor, and generated OUTPUT statements in insert mode.
NOTE An ASSIGN statement is required.
The ASSIGN statement (for example, ASSIGN; @Hp8711 to 800) is not generated when you are recording into an existing program and must be included in your program prior to any recorded OUTPUT commands. If you initially created the program using recording, this statement should already exist. If it does not exist, you will need to enter it.
SYSTEM OPTIONS
HP IBASIC Supplement 5-7
Developing Programs
Editing Your Program Using Edit

Editing with an External Keyboard

NOTE The external PC-AT compatible keyboard requires a mini-DIN
connector. The analyzer and the IBASIC editor work with IBM PC-AT compatible keyboards (US only) that have a mini-DIN connector. Non-US language keyboards will not cause an error, they simply will not be recognized as different from the US keyboard. A compatible keyboard can be purchased by ordering option 1CL with the analyzer. Keyboards with a standard DIN connector will need a mini-DIN to DIN adapter, HP part number 1252-4141.
The PC-AT keyboard, Figure 5-2, has four major key areas: Typewriter keypad Used to enter text and numeric
characters. Numeric keypad Used to enter numeric characters. Cursor keypad Used to move to cursor up/down a line,
or left/right to the next or previous
character position. Function keys F1 through F8 correspond to the
analyzer’s eight softkeys.
Figure 5-2 The PC Keyboard
IBASIC
Edit
Developing Programs
Editing Your Program Using Edit
Installing an External Keyboard
1. Remove power from the analyzer.
2. Connect the keyboard to the rear panel DIN KEYBOARD connector.
3. Turn on power to the analyzer.
4. Test the keyboard: a. Select the menu and use
the cursor keypad to position the cursor within the program for editing operations.
b. Use the Page Up and Page Down keys on the keyboard to scroll
through the program listing
SYSTEM OPTIONS
Inserting Lines
Insert one or more program lines above an existing line by placing the cursor on that line and pressing + on the keyboard. This key combination functions as a toggle to turn insert mode on and off.
HP IBASIC Supplement 5-9
Shift Insert
Developing Programs
Enter
Enter
Enter
Editing Your Program Using Edit
As an example, assume you want to insert some lines between two adjacent program lines numbered 90 and 100. Place line 100 in the current line position and press + . The program display “opens” and a new line, number 91, appears between line 90 and line
100. Enter the inserted line and another inserted line, number 92, will appear . If , after continuing to enter lines in this manner, the inserted line number increments to 100, then the current line 100 will be incremented one higher to accommodate the inserted line.
Shift Insert
To stop inserting lines, press + again or use the cursor keys to move to another program line. Make sure you have entered any changes to your final inserted line (with the key) before exiting the insert mode.
CAUTION Any changes you have made to the current line will be lost if you move
the cursor to another line without pressing .
Shift Insert
Editing Lines
Use the cursor keypad on the keyboard to move around the program for editing. The left and right arrow keys move within a program line and the up and down arrow keys move between lines. The alphanumeric keypad on the keyboard can be used for entering or editing text. The
Delete
When you finish editing or changing a program line, store it into the program by pressing on the keyboard. The computer checks the line for syntax errors and converts letter case to the required form for names and keywords (IBASIC commands). If no errors are detected, it stores the line in the program buffer.
key deletes the character highlighted by the cursor.
Developing Programs
Enter
Enter
Editing Your Program Using Edit

Entering Program Lines

When you finish entering or changing a program line, it must be stored into the program buffer by entering it in one of four ways:
1. Use the key on the front panel of the analyzer.
2. Use the softkey on the instrument.
3. Use the or key on the external keyboard.
4. Use the function key on the keyboard ( ) that represents the analyzer's softkey.
The computer checks the line for syntax errors and converts letter case to the required form for names and keywords (IBASIC commands).
If no errors are detected, it then stores the line.
CAUTION If you move to another line without pressing ENTER, changes are lost.
If you edit or enter text on the current program line and then move off the line without pressing ENTER, all editing on the line will be lost.
ENTER
Enter Return
F6
HP IBASIC Supplement 5-11
Developing Programs
Insert Line
Insert Char
Select Char/Word
Enter
Prior Menu
Select Char/Word
Space
Delete Char
Backspace
Enter
Prior Menu
Editing Your Program Using Edit

Editing from the Front Panel

Use the step keys to move the cursor up and down to select the line in the program. With the cursor located at the beginning of the line you want to change, use the knob to position the cursor within the line.
Character Entry
The character entry menu and the associated label window are activated by pressing the or softkeys. The knob and step keys now move the cursor in the label window.
Use the knob or step keys to move the label window's cursor until it highlights the desired letter or keyword and press . Continue editing until the line is correct. Press . The computer checks the line for syntax and then stores it in the program if the syntax is correct. Press to return to the edit menu.
The character entry menu provides the following softkeys:
()
F1
()
F2
()
F3
()
F4
()
F5
()
F8
Inserts the character or word highlighted by the label window cursor at the position marked by the program cursor.
Inserts a space at the position marked by the program cursor.
Deletes the character highlighted by the program cursor.
Deletes the last character before the program cursor.
Enters the edited program line. Returns to the edit menu and
de-activates the label window.
Developing Programs
Insert Line
Editing Your Program Using Edit
The Label Window
The label window is a scrolling list of the most common characters, symbols, and keywords used in IBASIC programming. It contains the uppercase alphabet, the numbers 0 to 9, symbols such as single and double quotation marks, parentheses, signs for mathematical and string operations as well as numerous other characters and symbols.
It also contains the following IBASIC keywords:
ABORT ENTER NOT ASSIGN FOR OUTPUT BIT GOTO PAUSE CALL IF PRINT CLEAR INPUT SUB DATA INTEGER SUBEND DIM LIST THEN DISP LOCAL TO END NEXT WAIT
Inserting Lines
To insert one or more program lines above any existing line, place the cursor on the existing line and press . This causes the cursor to move to a new line that appears above the existing one. Enter and store the inserted line and another inserted line will appear. Remember , eac h line must be ENTERed or any changes will be lost when the cursor is moved to a different line.
HP IBASIC Supplement 5-13
Developing Programs
Delete Char
Delete Char
Delete Char
Delete Char
Backspace
Backspace
Editing Your Program Using Edit

Removing Program Text

You can remove individual characters or entire lines with the editor.
Deleting Characters
The softkey removes the character under the cursor and moves all characters to the left one place. Repeatedly pressing
will cause text to the right of the cursor to be removed one character at a time. The softkey works the same way in both the line number and program statement fields. When used in the line number field, it deletes only line numbers to the right of the cursor (not program statement characters).
When using an external keyboard, there are other keys that perform the same function as the softkey . These are the key in the cursor keypad and the function key that maps to the appropriate softkey, for the edit menu or for the character entry menu.
Another way to remove text on a line is by backspacing. Pressing the
– / <—
analyzer removes the letter to the left of the cursor and moves the cursor (and all characters to the right of the cursor) one space to the left. The
F4
the external keyboard perform the same function. When the cursor is on a line number, using backspace simply moves the cursor back one position without deleting the number.
F5 F3
hardkey or the softkey on the front panel of the
function key or the key on the typewriter keypad of
Delete
Developing Programs
Delete Line
Delete Line
Delete Line
Delete Line
Delete Line
Delete Line
Recall Line
Enter
Editing Your Program Using Edit
Deleting Lines
The softkey allows you to remove the current program line. When the current program line disappears, all subsequent lines in the display move up one line, but are not renumbered. The cursor stays in the same column and moves to the next-highest numbered line.
If is pressed when the cursor is on the last program line, the line text is removed but the line number remains with the cursor in the first column of line. This puts the editor in insert mode on the last line of the program (see “Inserting Lines”). (To get out of insert mode, move the cursor up one line with the arrow key.)
Pressing will not remove a subprogram line with the SUB keyword in it unless all program lines belonging to that subprogram have already been deleted. A block of program lines can be deleted by executing the command DELETE x,y from an IBASIC command line (where x is the first line number in the block and y is the last line number).
When using an external keyboard, there are other keys that perform the same function as the softkey. These are +
Delete F3
the softkey in the edit menu.
in the cursor keypad, and the function key ( ) that maps to
Shift
Recalling a Deleted Line
The last line that was deleted using is saved in the analyzer. To recall this line, press the softkey or on an external keyboard. Press to restore the line to the program.
HP IBASIC Supplement 5-15
F4
Developing Programs
Enter
Enter
Prior Menu
IBASIC
Editing Your Program Using Edit

Renumbering, Copying, Moving, and Indenting Lines

If you want to change the line number of an edited program line, move the cursor to the line number field and enter the line number you want. Changing the line number causes a copy operation, not a move. Therefore, if you only want to move the line, change the line number first, press and then delete the original line. If you want to create an edited copy of the current line, edit the line and then change the line number and press . The edits will only appear in the copied line.
If you are inserting a program line and you change the line number, the line will move to its new location when you ENTER it. The editor will remain in insert mode at the new location in the program.
You will notice that when the cursor is in the line number field, entries operate in an overtype fashion rather than in the insert fashion as in the text portion of the program line. Also the (backspace) key moves the cursor over line numbers without deleting the number.
NOTE Renumbering the entire program with RENumber.
To renumber the entire program, IBASIC supports the RENumber command but you need an external keyboard to execute it. The command can be executed by following the steps listed below.
1. Exit the edit mode by pressing until the
SYSTEM OPTIONS
2. Partition an IBASIC display as described next in this chapter, or
press the Esc (Escape) key on the keyboard to enable the command line.
3. Enter the command REN x,y (where x is the new beginning line
number and y is the increment) from the command line of the IBASIC display
4. Another way to “renumber” program lines with an external keyboard
is to use the COPYLINES and MOVELINES commands. Use the INDENT command to make your code more readable.
menu is active.

Using IBASIC Display

IBASIC
IBASIC Display
IBASIC Display
Full
IBASIC Display
IBASIC Display
Developing Programs
Using IBASIC Display
Pressing the softkey ( on an external keyboard) allows you to allocate a partition of the analyzer's display to be used by your program or, alternately, to return any allocated partition to the analyzer.
The analyzer display is divided into two small partition areas (Upper and Lower) or one large area (Full), which encompasses both the Upper and Lower partition areas. See Figure 5-3 on page 19.
All screen output commands, such as PRINT and DRAW, require that you allocate a partition of the screen in order to view the results of the command. This can be performed in your program or interactively using the softkey. Allocating display partitions can be accomplished from within your program using the SCPI mnemonic “DISP:PROG” and specifying the parameter UPPER, LOWER or FULL. For example, the statement
OUTPUT 800;”DISP:PROG FULL”
allocates the entire display, corresponding to selecting from the
An IBASIC display partition cannot occupy the same location as a measurement channel display. When an IBASIC display is partitioned, it limits the amount of the screen available to simultaneously show measurement data. Table 5-1 shows the menu softkeys, their corresponding SCPI mnemonics, their functions, and the measurement data that can be viewed when the display partition is allocated.
SYSTEM OPTIONS
F7
menu.
HP IBASIC Supplement 5-17
Developing Programs
None
Full
Upper
Lower
Using IBASIC Display
Table 5-1 IBASIC Display Partitions
Softkey SCPI Mnemonic Allocates Visible Data
DISPlay:PROGram OFF No Display Measurement
DISPlay:PROGram FULL The Whole Display None
Channels 1 and 2
DISPlay:PROGram UPPer Upper
Measurement Channel Area
DISPlay:PROGram LOWer Lower
Measurement Channel Area
NOTE Split-screen format is automatically selected if UPPER or LOWER is
selected. When the UPPER or LOWER display partition is selected, the measurement display automatically selects the “split-screen” format. This format uses half of the screen to display each measurement channel's measurement data. Measurement channel 1 data is always shown on the upper half of the screen, and measurement channel 2 data is shown on the lower half. The split-screen format allows measurement data to be viewed simultaneously with IBASIC program output. For more information about the split-screen format, or other parts of the measurement display, refer to your analyzer's User's Guide.
Display allocation should be managed by your program using SCPI commands. The softkeys are best used during program development.
An IBASIC partition can be very useful during program development. It can be used to view program output, to query variables, and to execute IBASIC commands (such as GET and REN) outside of your program. Figure 5-3 on
page 19 shows the relative size and location of the different IBASIC
partitions and their command and display lines.
Measurement Channel 2 only
Measurement Channel 1 only
Figure 5-3 The IBASIC Display Partitions
More information about using display partitions within a program is available in Chapter 7, “Graphics and Display Techniques.”
Developing Programs
Using IBASIC Display
HP IBASIC Supplement 5-19
Developing Programs
IBASIC
Utilities
Clear Program
Stack Size
Stack Size
Select Disk
Configure VOL_RAM

Using UTILITIES

Using UTILITIES
Pressing the ( on an external keyboard) allows you to clear the program buffer, allocate memory for program use, or secure your program.
• Clear Program (F1)
• Stack Size (F2)
• Secure (F3) Executing erases the current program buffer and
frees all memory currently allocated. Memory size (see below) is reset to 8192 bytes. You will be prompted to ensure you do not accidentally erase the program.
program. At power up it is set by default to 8192 bytes. However, when a program is RUN, the analyzer will try to automatically set the memory size large enough to accommodate the program's stack and COM memory requirements.
For some programs the automatic memory sizing will be too small and you will get the message:
Error 2 in 100 Memory overflow
When this error occurs, you must manually set the to the value in bytes required by your program, up to the available memory in your system.
SYSTEM OPTIONS
allows you to set the stack memory to be used by your
F6
NOTE The total amount of memory available for IBASIC and VolRAMdisk may
change from firmware revision to revision. To determine the current available memory, press
. A memory report will appear on
the analyzer's display.
SAVE RECALL
is used to secure lines of your program. Secured lines cannot be
Secure
Perform Secure
Secure
listed, edited, or displayed. After you press this key you will see the following:
• Start Line # (softkey 1)
• End Line # (softkey 2)
• Perform Secure (softkey 4) After you have set the start and stop line numbers, execute the
operation.
CAUTION Do not secure the only copy of a program.
Once you have secured your program lines, there is no way to remove the security. Therefore, do not secure the only copy of your program. Make a copy of your original program, the copy, and keep the original in a safe place. This prevents unauthorized users from listing your program.
Developing Programs
Using UTILITIES
HP IBASIC Supplement 5-21
Developing Programs
Using UTILITIES

6 Debugging Programs

6-1
Debugging Programs
Continue
IBASIC
The process of creating programs usually involves correcting errors. You can minimize errors by using keystroke recording for measurements and other front panel sequences and by writing structured, well-designed programs.
IBASIC includes features that can help you find problems in a program. You can do the following:
RUN or CONTINUE your program
STEP through your program, executing one line at a time
• display the last error encountered in your program
• examine program variables
By examining the values assigned to variables at various places in the program, you can get a much better idea of what is really happening in your program.
By inserting a PAUSE statement in your program, you can pause the program at any line and then examine the values of variables at that point in the program. You can then press in the
SYSTEM OPTIONS
PAUSE statement (or the program end).
menu to resume operation to the next
NOTE An external keyboard is required for effective program debugging.
These capabilities can be used together to effectively examine the program's operation and solve your particular problems.
Most of the debugging techniques described in this chapter make use of an external keyboard. The analyzer and the IBASIC editor work with IBM PC-AT compatible keyboards (US only) that have a mini-DIN connector. Non-US language keyboards will not cause an error, they simply will not be recognized as different from the US keyboard. A compatible keyboard can be purchased by ordering option 1CL with the analyzer. Keyboards with a standard DIN connector will need a mini-DIN to DIN adapter, HP part number 1252-4141.
Debugging Programs
Step
Continue

Setting Breakpoints

Setting Breakpoints
A common method of debugging a program involves the use of breakpoints. A breakpoint causes the program to stop before executing a specified line so that you can examine the program state at that point. In IBASIC this can be accomplished by inserting PAUSE statements in the program code. Note that PAUSE is one of the IBASIC keywords included in the editor's label window (described in Chapter 5, “Developing Programs”). When the program is then run, you can use the command line to check or change variable values.
Execution of the program can be resumed in one of two ways.
• Press ( on an external keyboard) to execute the next program line.
• Press ( on an external keyboard) to continue the program until the next PAUSE, STOP or END statement is encountered.
F3
F2
HP IBASIC Supplement 6-3
Debugging Programs
Pause

Examining Variables

Examining Variables
To examine a variable, it is necessary to pause the program. Pause the program by pressing the softkey ( on an external keyboard) when a program is running, or by inserting aPAUSE statement in your program.
A command line becomes active when an IBASIC program is paused or stopped and an IBASIC display partition is present. (For information on creating an IBASIC display partition, see “Using IBASIC Display” in
Chapter 5.) You may also activate the command line when no IBASIC
window is partitioned by pressing the key on the external keyboard. A cursor will appear in the lower left portion of the screen when the command line is active. Strike the key again to de-activate. Once the command line is active, a variable can be examined in two ways. Both methods require the use of an external keyboard.
1. Enter the variable name (without a line number) on the command line. This results in the value assigned to that variable being shown in the display line of the IBASIC window.
F8
ESC
ESC
2. Execute the command PRINT Value from the command line (where Value is the name of the variable being examined). This results in
the value assigned to that variable being shown on the print screen of the IBASIC window.
To examine a variable without accessing a command line, it is necessary to add the statement PRINT Value (or DISP Value) to the program before the PAUSE statement that temporarily stops the program. PAUSE, PRINT and DISP are all keywords that are included in the IBASIC editor's label window (see Chapter 5, “Developing Programs,” for a description of the label window).
NOTE An IBASIC display partition must be active to view the results of a
PRINT statement or to access a command line. The display line (accessed with the DISP command) is available even when no IBASIC display is present.
Debugging Programs
Examining Variables

Examining Strings

Enter string variables as you would any other variable. Any string variable entered without delimiters will display as much of the string as will fit on the display line of the screen (up to 58 characters).
To select only a section of a string, use the IBASIC substring syntax (see the “HP Instrument BASIC Programming T echniques” section of theHP Instrument BASIC Users Handbook). For example, to examine the 7 character substring starting at the second character of A$, enter
A$[2;7] on the command line or execute the command PRINT A$[2;7].

Examining Arrays

To select an array to be examined, you can either select individual elements or the entire array. For example, the following entry:
I_array(1),I_array(2),I_array(3)
selects the elements 1 through 3 of the array I_array to be displayed. You may select an entire array to be examined by entering the array
variable name and specifying a wildcard (*) for the element (such as I_array(*)). If I_array(20) is an integer array, and the first and second elements are set to 100, entering I_array(*) would display the following:
100100000000000000000000
Individual array elements (e.g., I_array(17)) can also be specified in the same way as any other single variable.
HP IBASIC Supplement 6-5
Debugging Programs

Displaying the Last Error Encountered

Displaying the Last Error Encountered
It is sometimes useful to review the last error encountered by a program that is being run. This is done from the command line by examining the value assigned to the variable name ERRM$. This value will include the error number and message of the last error encountered by the program.
An additional method of displaying the error message is to use an error trapping subroutine.
For example, insert the following line at the beginning of a program.
ON ERROR GOSUB Errormsg
The subroutine Errormsg should then be included at the end of the program (after execution is stopped but before the END command).
100 Errormsg:! 110 DISP ERRM$ 120 PAUSE 130 RETURN
The error message is automatically shown on the display line of the IBASIC window and program execution is paused when an error message is encountered.
You may also encounter SCPI errors in addition to IBASIC errors. SCPI errors can occur when a command syntax is unrecognized or incorrect. For more details on SCPI errors, refer to the Programmer's Guide.
7 Graphics and Display
Techniques
7-1
Graphics and Display Techniques

Display Partitions

Display Partitions
IBASIC programs have the ability to allocate portions of the instrument's display for program output, including text and graphics. This section provides a description of the various programming techniques used to do both. Any of three measurement display areas, called display partitions, can be used by an IBASIC program. These partitions are shown in Figure 7-1.
The analyzer has two measurement channels which can be displayed simultaneously. The instrument's screen can be split into two trace areas for this purpose (upper for measurement channel 1 and lower for measurement channel 2). Additionally, the two measurements can be overlaid onto one full size screen (the default setting). For more information, refer to the Automating Measurements User’s Guide Supplement for more information.
Figure 7-1 Display Partitions on the Analyzer
Graphics and Display Techniques
IBASIC
IBASIC Display
None
Full
Upper
Lower

Using the Display Partitions

Using the Display Partitions
Many IBASIC commands (such as PRINT, DISP, CLEAR SCREEN, MOVE, DRAW and GCLEAR) require a display as an output device. These
commands output data to the screen by writing to a screen buffer. Since IBASIC programs share all the hardware resources with the instrument, the display must be shared for instrument and program use.
In order to view this output buffer, a portion of the display must be released from the instrument. When no program is running, you can do this manually, using the
softkey menu. To do this within a running program requires sending a command to the analyzer both to borrow a part of the display and again to return it for the instrument's use.
This process is called allocation of display partitions. Manual allocation of display partitions is described in Chapter 5, “Developing Programs.”Table
7-1 below includes a summary of the available partitions, their locations
and the SCPI mnemonic used to select each partition.
SYSTEM OPTIONS
Table 7-1 IBASIC Display Partitions
Softkey SCPI Mnemonic Allocates
DISPlay:PROGram OFF No Display
()
F1
DISPlay:PROGram FULL The Whole Display
()
F2
DISPlay:PROGram UPPer Upper Measurement Channel
()
F3
DISPlay:PROGram LOWer Lower Measurement Channel
()
F4
HP IBASIC Supplement 7-3
Area
Area
Graphics and Display Techniques
Using the Display Partitions

Allocating Display Partitions

To request a display partition from the analyzer for use by an IBASIC program, send the instrument the corresponding SCPI mnemonic.
DISP:PROG UPPer Allocates upper partition DISP:PROG LOWer Allocates lower partition DISP:PROG FULL Allocates full-screen partition
For example, to print a message to the upper partition area, you might use a program segment like this:
30 ASSIGN @Hp8711 TO 800 40 OUTPUT @Hp8711;”DISP:PROG UPPer” 50 CLEAR SCREEN 60 PRINT “This is the upper partition”
To be sure that you are not writing to a partition that has not yet been assigned, you should include a WAIT statement or , preferably, add a SCPI query command followed by an ENTER statement to synchronize the program with the instrument. The previous example might then look like this:
30 ASSIGN @Hp8711 TO 800 40 OUTPUT @Hp8711;”DISP:PROGUPPer” 42 OUTPUT @Hp8711;”DISP:PROG?” 44 ENTER @Hp8711;Screen$ 46 IF Screen$<>”UPP” THEN GOTO 42 50 CLEAR SCREEN 60 PRINT “This is the upper partition”
The mnemonic DISP:PROG? (line 42 above) requests the instrument to send the current partition status. The ENTER statement on the next line reads that status, assigns the value to the variable Screen$, and continues.
Graphics and Display Techniques
Using the Display Partitions

De-Allocating Display Partitions

To return the display partition to the analyzer for use as a measurement screen, use the “DISP:PROG OFF” mnemonic. This should be done before the termination of any program that has allocated a display partition. It may also be required within the program to allow the user to view instrument measurement data. The following example demonstrates this command:
830 OUTPUT @Hp8711;”DISP:PROG OFF”

Operation with No Display Partition

IBASIC programs can also access the analyzer's display when no partition has been allocated. This can be done through the use of certain areas of the screen. One of these areas is the area reserved for softkey labels. It is accessed using the ON KEY statement.
A second area is a display line (or command line) that appears when no part of the display is allocated for use by IBASIC. This display line, which is located at the lower left corner of the active measurement channel graticule, appears when needed by the INPUT or DISP commands or when activated. To activate the command line, press
on an external keyboard.
ESC
Figure 7-2 on page 6 shows an example of the use of this display line.
When the INPUT command is being used, the IBASIC editor's label window and character entry softkey menu appear. Refer to Chapter 5,
“Developing Programs,” for a description of the IBASIC editor.
HP IBASIC Supplement 7-5
Graphics and Display Techniques
Using the Display Partitions
Figure 7-2 Using INPUT with No Display Partition
In addition to the commands described above, the analyzer has “User Graphics” commands that can write to any of the display partitions. These commands can be used to write to measurement windows as well as the IBASIC window. These commands are described in the “SCPI Graphics Commands” section of this chapter.
Graphics and Display Techniques

Displaying Text

Displaying Text
Most of IBASIC's text capabilities are covered in detail in the “HP Instrument BASIC Programming Techniques” section of the HP Instrument BASIC Users Handbook. The PRINT statement works the same way in every display partition. Information is printed starting at the top left corner of the current partition and continues until the display line of the partition is reached. The screen then scrolls up to allow additional lines to be printed. Figure 7-3 on page 8 shows the different display partitions and the location of text printed to them. Note that causing the screen to scroll does not affect any graphics displayed on the screen, since text and graphics are written to different planes of the display.
All partitions have a width of 58 characters. The height varies according to partition. Both upper and lower partitions contain 10 lines, while the full partition contains 22 lines.
HP IBASIC Supplement 7-7
Graphics and Display Techniques
Displaying Text
Display partition coordinates are important if you are using the PRINT TABXY statement to position text. For example, the following program
segment prints a message in the center of the full partition (assuming it has been allocated earlier in the program). See Figure 7-3, below.
100 Maxlines=22 110 Tabx=(58-LEN(“This is CENTERED text.”))/2 120 PRINT TABXY(Tabx,Maxlines/2);”This is CENTERED text.”
Figure 7-3 Printing to a Display Partition
(1,1) (58,1)
This is CENTERED text.
(1,22) (58,22)
Graphics and Display Techniques
Displaying Text

Getting Text to the Screen Quickly

A useful technique to get text onto the screen quickly is to write your display message to a long string using the OUTPUT statement, and then print the string to the screen. For large amounts of text, this speeds up screen display time considerably. The following program segment demonstrates this:
60 DIM Temp$[100],Big$[2000] 70 OUTPUT Big$;”This is the first line of text” 80 OUTPUT Temp$;”This is the second line of text” 90 Big$=Big$&Temp$ 100 PRINTER IS CRT; WIDTH 2000 110 PRINT Big$
The OUTPUT statements in this example are used to copy each line of the message into the variable Temp$ and append a carriage return.
You can also print to the screen using the OUTPUT statement in conjunction with the display address (1). For example, line 150 below writes a string to the screen.
120 OUTPUT CRT;”OUTPUT 1 WORKS WELL TOO”

Pop-Up Message Windows and Custom Annotations

From your IBASIC program, you can replace instrument annotations with user-defined annotations. You can change the X-axis labels and measurement channel annotations to customize the display. Pop-up messages can also be used to display permanent or temporary messages. Refer to the Automating Measurements User’s Guide Supplement.
HP IBASIC Supplement 7-9
Graphics and Display Techniques
Displaying Text

Graphics Initialization and Scaling

In all partitions, display coordinate 0,0 is at the bottom left corner and the image is cropped to fit the display if the X,Y coordinate exceeds the displayable range of the current partition. Figure 7-4 shows the different partitions and the pixel dimensions (GESCAPE values) for each.
After a GINIT command, the display is dimensioned as 100 GDUs (Graphical Display Units) high and 122 GDUs wide (assuming a full partition). This gives a RATIO (aspect ratio) result of 1.22 and provides the same results as issuing a WINDOW 0,122,0,100 command. To prevent circles from appearing oval in shape, this ratio should be maintained. Y ou can also issue a WINDOW 0,537,0,439 command. This will maintain the same ratio but the display will now be dimensioned in actual pixel units. This may be more useful than the default GINIT values since fractional display units are not needed, it allows integers only to be used; thus speeding execution. These are also the same values that are returned by using the GESCAPE command (see BARCODE program example). The GESCAPE command will always set the current pixel dimension sizes. Because the results of this command can vary drastically with partition size, you must first partition the display before executing the GINIT and GESCAPE commands.
NOTE Upon power up, the default display coordinates are 0,537,0,439 and
will remain that until a GINIT is performed. It is recommended that a GINIT command always be part of any graphics program and that it be executed only after the display partition is set.
Figure 7-4 Pixel Dimensions with Available Display Partitions
Graphics and Display Techniques

Using Graphics

Using Graphics
IBASIC graphics commands are easy to understand and use. You can use the MOVE statement to move the “pen” to a specific pixel location (without drawing) and then draw a line from the current pen location to another pixel coordinate using the DRAW statement. The GCLEAR statement removes all graphics.
The PEN command provides an easy method of erasing lines drawn by the DRAW command. When PEN 1 is issued (the default state), all DRAW commands act normally, drawing a line with the full intensity . WhenPEN 0 is issued, all DRAW commands erase any pixels their path encounters. Where there are no lines in the path, no change is visible. As an example of using the MOVE and DRAW commands, the following statement moves the logical pen to a point 100 units to the right of, and 150 units above, the lower left corner of the display:
100 MOVE 100,150
This statement then draws a line to coordinates (200,10):
110 DRAW 200,10
Finally, these two statements erase the previously drawn line:
120 PEN 0 130 DRAW 100,150
Although text and graphics appear together, you can clear them separately. Use CLEAR SCREEN to clear the text. Use GCLEAR to clear the graphics.
HP IBASIC Supplement 7-11
Graphics and Display Techniques

Drawing Figures

Drawing Figures
Some IBASIC keywords listed below may be used to simplify drawings and setup diagrams. See the section titled “Graphics Exceptions, ” later in this chapter.
POLYGON - Draws all or part of a regular polygon. RECTANGLE - Draws a rectangle. LABEL - Produces alphanumeric labels. CSIZE - Sets size and aspect ratio of labels. LDIR - Defines the angle at which a label is to be drawn. LORG - Defines the relative origin of a label.
These keywords are used in the “BARCODE” program example listed in the Example Programs Guide, and on the Example Programs Disk. The keywords appear in the subprograms “Box”, “Circle”, and “Label” described below.
1700 Box:SUB Box(Xpos,Ypos,Xsize,Ysize) 1710 COM /Scale/ Sc,INTEGER X,Y 1720 MOVE X+(Xpos-Xsize/2)*Sc,Y+(Ypos-Ysize/2)*Sc 1730 RECTANGLE Xsize*Sc,Ysize*Sc 1740 SUBEND 1750 ! 1760 Circle:SUB Circle(Xpos,Ypos,Radius) 1770 COM /Scale/ Sc,INTEGER X,Y 1780 MOVE X+Xpos*Sc,Y+Ypos*Sc 1790 POLYGON Radius*Sc,16,16 1800 SUBEND 1810 ! 1820 Connect:SUB Connect(X1,Y1,X2,Y2,How) 1830 COM /Scale/ Sc,INTEGER X,Y 1840 MOVE X+X1*Sc,Y+Y1*Sc 1850 SELECT How 1860 CASE 1 !...diagonal 1870 DRAW X+X2*Sc,Y+Y2*Sc 1880 CASE 0 1890 DRAW X+X1*Sc,Y+Y2*Sc 1900 DRAW X+X2*Sc,Y+Y2*Sc 1910 CASE -1 1920 DRAW X+X2*Sc,Y+Y1*Sc 1930 DRAW X+X2*Sc,Y+Y2*Sc 1940 END SELECT 1950 SUBEND 1960 ! 1970 Label:SUB Label(Text$,Xpos,Ypos,Size,Lorg,Ldr,Pen) 1980 COM /Scale/ Sc,INTEGER X,Y 1990 LORG Lorg
Graphics and Display Techniques
Drawing Figures
2000 LDIR Ldr 2010 CSIZE Size*Sc,.55 2020 MOVE X+Xpos*Sc,Y+Ypos*Sc 2030 PEN Pen 2040 LABEL Text$ 2050 PEN 1 2060 SUBEND 2070 !
The following program displays a “HELP” screen and demonstrates many of the techniques discussed so far. Running this program produces the screen display shown in Figure 7-5.
10 DIM A$[58],String$[1000] 20 ASSIGN @Hp8711 TO 800 30 OUTPUT @Hp8711;"DISP:PROG FULL;*WAI" 40 GINIT 50 GCLEAR 60 MOVE 0,89 70 RECTANGLE 200,14 80 PRINT TABXY(24,2);"HELP" 90 OUTPUT A$;"This program demonstrates how to print several" 100 String$=String$A$ 110 OUTPUT A$;"lines of text at one time. This method offers" 120 String$=String$A$ 130 OUTPUT A$;"the fastest possible print speed." 140 String$=String$A$ 150 PRINTER IS CRT;WIDTH 1000 ! Prevent auto cr/lf 160 PRINT TABXY(1,5);String$ 170 END
Figure 7-5 “HELP” Program Output
HP IBASIC Supplement 7-13
Graphics and Display Techniques
Drawing Figures

Graphics Exceptions

The following graphics commands do not conform to the keyword description found in the HP Instrument BASIC Users Handbook:
VIEWPORT - Does not create isotropic units that are physically square. Does not soft clip the display area.
CLIP - The analyzer does not support graphics clipping. SHOW - Does not create isotropic units. POLYLINE, POLYGON, RECTANGLE, RPLOT - The analyzer does not
support the FILL or EDGE options. Also see next paragraph. LINE TYPE - The analyzer does not support different line types.
GRID, RECTANGLE, POLYGON, and POLYLINE scaling differences
When the display is initialized using GINIT, the display will be scaled to a height of 100 GDUs and a width of 122 GDUs.
The ratio is 1.22 and the pixel height-to-width ratio is fixed at 1.0 (square pixels).
NOTE Previous analyzer models may have scaling differences.
When converting programs from previous models (such as HP 8711A/B and family) to run on an HP 8712 ET/ES or HP 8714 ET/ES, scaling differences will affect all graphics commands. The ET/ES family of network analyzers (as well as the HP 8711C family) have square pixels. The older “A” and”B” family network analyzers had a non-square pixel height-to-width ratio of 1.79.

Labeling with Different Partitions

The LABEL command can be used to label graphs, however, note that labels that may be of the correct size for a full screen partition will appear half as big if a GINIT is performed after the analyzer has been set to either the upper or lower half partition. This is because the CSIZE command scales according to display height, not width. Since the display height is one-half, the character size will also be one-half . Labels that are scaled properly for full screen displays will not be scaled properly for half screen displays and vice-versa.
Graphics and Display Techniques

SCPI Graphics Commands

SCPI Graphics Commands
In addition to the commands described earlier in this chapter, there are several SCPI mnemonics that can be used to create graphics and messages on the display of the analyzer.
These commands are instrument-specific mnemonics, not standard IBASIC commands. They are also different from the previously described IBASIC commands because an IBASIC display partition is not required. This means that they can be used to write or draw directly to a measurement window.
These commands, listed in Table 7-2 on page 16, are SCPI mnemonics and are programmable from an external controller as well as from IBASIC. The commands are of the following form
DISPlay:WINDow[1|2|10]:GRAPhics:<command>
The number specified in the WINDow part of the command selects where the graphics are to be written.
WINDow1 draws the graphics to the channel 1 measurement window. WINDow2 draws the graphics to the channel 2 measurement window. WINDow10 draws the graphics to an IBASIC display partition.
TIP Graphics written directly to a measurement window are not
redrawn sweep-to-sweep. When SCPI graphics commands are used to write directly to a measurement window, they write to the static graphics plane (the same plane where the graticule is drawn). There is no sweep-to-sweep speed penalty once the graphics have been drawn.
HP IBASIC Supplement 7-15
Graphics and Display Techniques
SCPI Graphics Commands
Table 7-2 SCPI Graphics Commands
SCPI COMMAND FORM DESCRIPTION
DISPlay:WINDow[1|2|10]:GRAPhics :CIRCle <radius>
DISPlay:WINDow[1|2|10]:GRAPhics :CLEar
DISPlay:WINDow[1|2|10]:GRAPhics :COLor <num>
DISPlay:WINDow[1|2|10]:GRAPhics [:DRAW] <x>,<y>
DISPlay:WINDow[1|2|10]:GRAPhics :LABel <string>
DISPlay:WINDow[1|2|10]:GRAPhics :LABel:FONT <font>
DISPlay:WINDow[1|2|10]:GRAPhics :MOVE <x>,<y>
command only
command only
NR1 Sets the color of the user graphics pen
command only
command only
CHAR Selects the user graphics label font —
NR1,NR1 Moves the pen to the specified new pen
Draws a circle of the specified Y-axis radius centered at the current pen location — radius is in pixels.
Clears the user graphics and graphics buffer for the specified window.
— choose from 0 for erase, 1 for bright, and 2 for dim.
Draws a line from the current pen position to the specified new pen position — x and y are the new absolute X and Y coordinates in pixels.
Draws a label with the lower left corner at the current pen location.
choose from
SMALl|HSMall|NORMal|HNORmal |BOLD|HBOLd|SLANt|HSLant.
position — x and y are the new absolute X and Y coordinates in pixels.
DISPlay:WINDow[1|2|10]:GRAPhics :RECTangle <xsize>,<ysize>
DISPlay:WINDow[1|2|10]:GRAPhics :SCALe <xmin>,<xmax>,<ymin>,<ymax>
command only
command only
Draws a rectangle of the specified size with lower left corner at the current pen position — xsize and ysize are the width and height in pixels.
Specifies a new coordinate system for the specified window. Subsequent graphics commands will use these new coordinates. This command may be useful for converting older programs to work on your analyzer. (See “Graphics Exceptions,” earlier in this chapter.)
Graphics and Display Techniques
SCPI Graphics Commands

For More Information

For more information about the analyzer's user graphics commands, refer to Chapter 7 of the Programmer's Guide. Refer also to the example program titled “GRAPHICS” in the Example Programs Guide.
HP IBASIC Supplement 7-17
Graphics and Display Techniques
SCPI Graphics Commands
8 Interfacing with External
Devices
8-1
Interfacing with External Devices
This chapter describes the techniques necessary for programming the HP-IB interface. It describes how this interface works and how to use it to control or interface with systems containing various HP-IB devices. It also describes how to interface with external devices using the serial and parallel interfaces.
The HP-IB interface is Hewlett-Packard's implementation of the IEEE-488.2 Digital Interface for Programmable Instrumentation. The acronym HP-IB stands for “Hewlett-Packard Interface Bus ,” and is often referred to as the “bus.” The interface is easy to use and allows great flexibility in communicating data and control information between an HP Instrument BASIC program and external devices.
IBASIC is an HP-IB instrument controller residing inside an instrument. It uses the instrument's HP-IB interface for external communication and an internal HP-IB interface to communicate with the instrument. This unique arrangement presents a few differences between IBASIC's implementation of HP-IB control and HP BASIC controllers. A description of the interaction of IBASIC with the host instrument and the external HP-IB interface is given in the section entitled “The IBASIC HP-IB Model,” later in this chapter.
Interfacing with External Devices

Communication with Devices

Communication with Devices

HP-IB Device Selectors

Since the HP-IB allows several devices to be interconnected, each device must be uniquely identified. Specifying the select code (such as 7 or 8) of the HP-IB interface to which a device is connected, is not enough to uniquely identify each specific device on the bus.
Each device on the bus has a primary address that identifies it. This address can be set by the user. It must be unique to allow individual access of each device. When a particular HP-IB device is to be accessed, it must be identified with both its interface select code and its bus address.
The interface select code is the first part of an HP-IB device selector. IBASIC programs run inside an instrument and communicate with it over an internal bus (interface select code 8). IBASIC programs can also communicate with external devices using the instrument's HP-IB interface (select code 7).
The second part of an HP-IB device selector is the device's primary address, an integer in the range of 0 through 30. For example, to specify the device on the interface at select code 7 with a primary address of 22, use device selector 722. Secondary HP-IB addressing is also supported for those devices requiring it. These devices will have at least 5-digit service selection such as 72201.
Since the analyzer is the only device on the internal interface, its primary address on that interface is arbitrary and the instrument will respond to any primary address with a select code equal to 8 (e.g., 800, 811, 822, etc.).
NOTE Each HP-IB device address must have a unique HP-IB address.
The analyzer is shipped from the factory with a primary address of 16. No other device on the bus should use the same address.
HP IBASIC Supplement 8-3
Interfacing with External Devices
HP-IB
Communication with Devices
Setting Device Addresses
The procedure for setting the address of an HP-IB device is given in the installation manual for each device. To set the address of the analyzer, use the softkeys in the menu, or the SCPI mnemonic SYST:COMM:GPIB:ADDR.
SYSTEM OPTIONS

Moving Data through the HP-IB

Data is output and entered into the program through the HP-IB with the OUTPUT and ENTER statements, respectively. The only difference between the OUTPUT and ENTER statements for the HP-IB and those for other interfaces is the addressing information within HP-IB device selectors.
The following examples show several different syntax styles which you can use.
100 Hpib=7 110 Device_addr=22 120 Device_selector=Hpib * 100 + Device_addr 130 ! 140 OUTPUT Device_selector;”F1R7T2T3” 150 ENTER Device_selector;Reading
320 ASSIGN @Hpib_device TO 702 330 OUTPUT @Hpib_device;”Data message” 340 ENTER @Hpib_device;Number
440 OUTPUT 800;”SOUR1:POW -10 dBm” 480 ENTER 724;Readings(*)
Interfacing with External Devices
System Controller
HP-IB
Communication with Devices

General Structure of the HP-IB

Communications through the HP-IB are made according to a precisely defined standard, IEEE 488.1. The rules set by IEEE 488.1 ensure that orderly communication takes place on the bus. For more information about the structure of the HP-IB and the IEEE 488.1 standard, refer to the Tutorial Description of the Hewlett-Packard Interface Bus.
Devices that communicate over the HP-IB perform one or more of the following three functions:
Talk — send data over the bus Listen — receive data over the bus Control — control the exchange of data on the bus
The System Controller
The controller is a device that has been designated to control all communication occurring on the bus. It specifies which device talks, which device listens, and when the exchange of data takes place.
An HP-IB system can have more than one device with the ability to control the bus, but only one of these devices is allowed to control the exchange of data at any given time. The device that is currently controlling the exchange of data is called the Active Controller.
One device must be able to take control of the bus even if it is not the active controller . The device designated as theSystem Controller is the only device with this ability. To designate the analyzer as the system controller, use the softkey in the
SYSTEM OPTIONS
The system controller is generally designated before running a program and should not be changed under program control. An exception to this is when an IBASIC program is running on the analyzer's internal controller. If the IBASIC program controls other HP-IB devices, the analyzer must be designated as the system controller.
A SCPI mnemonic SYST:COMM:GPIB:CONT <ON|OFF> can be used to make the analyzer the system controller. Program execution should be carefully synchronized by using the Operation Complete command (*OPC?) and waiting for a reply before any OUTPUT 7xx command is sent. (Refer to the “Synchronizing the Analyzer and a Controller” chapter in the Programmer's Guide for more information on the *OPC? command.)
HP IBASIC Supplement 8-5
menu.
Interfacing with External Devices
Communication with Devices

Using the Serial and Parallel Ports

The analyzer has a parallel port and a serial port for use with peripherals (like printers and plotters), material handlers and other devices. Active control of the HP-IB interface is not needed when these ports are being used.
In addition to the serial and parallel ports, there are also two BNC connectors on the rear panel of the analyzer. These connectors provide access (using TTL signal levels) to two programmable bits:
Limit Test TTL bit — indicates the results of a pass/fail limit test User TTL bit — to be used as needed (for example to be used with a
foot pedal)

Using the Analyzer P orts in IBASIC Programs

IBASIC can directly control the serial port, the parallel port, the Pass/Fail TTL bit, and the User bit without using the HP-IB commands along with READIO and WRITEIO commands. However, READIO and WRITEIO are faster than HP-IB commands.
Interfacing with External Devices
Communication with Devices
Table 8-1 Writable Ports [I=WRITEIO(A,B)]
Port,
IO Type
WRITEIO 15,0;A Outputs 8-bit data to the Cent_DO through D7 lines of the
WRITEIO 15,1;A Sets/clears the “user” bit according to the least significant bit of
Register,
Data
Description
Centronics port. Cent_DO is the least significant bit, Cent_D7 is the most significant bit. Sets Printer_select signal high (de-select). Checks Centronics status lines for the following:
OUT OF PAPER
PRINTER NOT ON LINE
BUSY
ACKNOWLEDGE
A. A least significant bit equal to 1 sets the user bit high. A least significant bit of 0 clears the user bit.
WRITEIO 15,2;A Sets/clears the limit pass/fail bit according to the least significant
bit of A. A least significant bit equal to 1 sets the pass/fail bit high. A least significant bit of 0 clears the pass/fail bit.
WRITEIO 15,3;A Outputs 8-bit data to the Cent_D0 through D7 lines of the
Centronics port. Cent_D0 is the least significant bit, Cent_D7 is the most significant bit. Sets Printer_select signal high (de-select). Does not check Centronics status lines.
WRITEIO 9,0;A Outputs a byte to the serial port. The byte is output serially
according to the configuration for the serial port. (See above.)
HP IBASIC Supplement 8-7
Interfacing with External Devices
Communication with Devices
Table 8-2 Readable Ports [I=READIO(A,B)]
IO Type Register Description
READIO 9,0 Reads the serial port. READIO 15,0 Reads the 8-bit data port, Cent_D0 through D7. READIO 15,1 Reads the user bit. READIO 15,2 Reads the limit test pass/fail bit. READIO 15,10 Reads the 8-bit status port .
D0 – Cent_acknowledge
D1 – Cent_busy
D3 – Cent_on_line
D2 – Cent_out_of_paper
D4 – Cent_printer_err
An example program, REPORT, demonstrating peripheral control over the parallel port is provided in the Example Programs Guide.
Refer to the Automating Measurements User’s Guide Supplement for further explanation and examples of how to access the analyzer's I/O ports.
Interfacing with External Devices

General Bus Management

General Bus Management
The HP-IB standard provides several mechanisms to manage the bus and the devices on the bus. Here is a summary of the IBASIC statements that use these control mechanisms:
ABORT — abruptly terminates all bus activity and resets all devices to their power-on HP-IB states.
CLEAR — sets selected (or all) devices to a pre-defined, device-dependent HP-IB state.
LOCAL — returns selected (or all) devices to local (front panel) control. LOCAL LOCKOUT — disables selected (or all) devices' front panel controls. REMOTE — puts selected (or all) devices into their device-dependent,
remote modes. SPOLL — performs a serial poll of the specified device (which must be
capable of responding). TRIGGER — sends the trigger message to a device (or selected group of
devices). The actions that a device takes upon receiving each of the above
commands are different for each device. F or external devices , refer to the particular device's manuals to determine how it will respond.
All of the bus management commands, with the exception of ABORT, require that the program be the active controller on the interface. A running IBASIC program is always the active controller on the internal interface (select code 8). The instrument must either be set as system controller or have control passed to it from an external controller for the program to be the active controller on the external interface (select code
7). The program automatically assumes the controller status of the host instrument. For more information, refer to “The IBASIC HP-IB Model” section later in this chapter.
NOTE In this section the term Host Instrument refers to the instrument where
the IBASIC controller is located.
HP IBASIC Supplement 8-9
Interfacing with External Devices
Return to Local
General Bus Management

REMOTE

Most HP-IB devices can be controlled from the front panel or from the bus. If the device's front panel controls are currently functional, it is in the Local state. If it is being controlled through the HP-IB, it is in the Remote state. Unless operating in the Local Lockout mode, each HP-IB device has method (usually a key) to return itself to Local (front panel) control.
When the analyzer is being controlled by a program running on an external controller, the softkey is always available to return the analyzer to Local control.
The Remote message is automatically sent to all devices whenever the system controller is powered on, reset, or when it sends the Abort message. A device also enters the Remote state automatically whenever it is addressed. The REMOTE statement also outputs the Remote message, which causes all (or specified) devices on the bus to change from local control to remote control. The host instrument must be designated as the system controller before an IBASIC program can execute the REMOTE statement on select code 7.
Host Instrument
The REMOTE statement has no effect on the host instrument since it is always in remote control whenever an IBASIC program is running. Specifying the internal interface in a REMOTE statement will not generate an error, but will have no effect.

LOCAL LOCKOUT

The Local Lockout message effectively locks out the “local” switch present on most HP-IB device front panels. It maintains system integrity by preventing a user from interfering with system operations by pressing buttons. As long as Local Lockout is in effect, no bus device can be returned to local control from its front panel.
The Local Lockout message is sent by executing the LOCAL LOCKOUT statement. This message can be sent to all devices on the external interface by specifying the bus address (7). Specifying a single address on the bus (i.e. 722) sends the command to only the device at that address. The Local Lockout message is cleared when the Local message is sent by executing the LOCAL statement. However, executing the ABORT statement does not cancel the Local Lockout message.
Interfacing with External Devices
General Bus Management
Host Instrument
The Local Lockout message is not supported for the host instrument since front panel control is always necessary in order to pause or abort the program. Specifying the internal interface in a LOCAL LOCKOUT statement will not generate an error, but will have no effect.

LOCAL

During system operation, it may be necessary for an operator to interact with one or more external devices. For instance, an operator might need to work from the front panel to make special tests or to troubleshoot. It is also good systems practice to return all devices to local control when remote-control operations are complete. Executing the LOCAL statement returns the specified devices to local (front panel) control.
If primary addressing is specified, the Go-to-Local message is sent only to the specified device(s). However, if only the interface select code is specified (LOCAL 7), the Local message is sent to all devices on the external interface and any previous Local Lockout message (which is still in effect) is automatically cleared.
Host Instrument
The LOCAL statement has no effect on the host instrument since it is always in remote control whenever an IBASIC program is running. Specifying the internal interface in a LOCAL statement will not generate an error.

TRIGGER

The TRIGGER statement sends a Trigger message to a selected device or group of devices. The purpose of the Trigger message is to initiate some device-dependent action; for example, it can be used to trigger a digital voltmeter to perform its measurement cycle. Because the response of a device to a Trigger message is strictly device-dependent, neither the Trigger message nor the interface indicates what action is initiated by the device.
Specifying only the interface select code outputs a Trigger message to all devices currently addressed to listen on the bus. Including a device address in the statement triggers only the device addressed by the statement.
HP IBASIC Supplement 8-11
Interfacing with External Devices
General Bus Management
Host Instrument
The TRIGGER statement is supported by the analyzer . Issuing aTRIGGER command will initiate a single sweep assuming the analyzer is in TRIGGER hold mode. TRIGGER is ignored if not in hold mode.

CLEAR

The CLEAR statement provides a means of “initializing” a device to its predefined device-dependent state. When the CLEAR statement is executed, the Clear message is sent either to all devices or to the specified device, depending on the information contained within the device selector. If only the interface select code is specified, all devices on the specified HP-IB interface are cleared. If primary-address information is specified, the Clear message is sent only to the specified device. Only the active controller can send the Clear message.
Host Instrument
The CLEAR statement is fully compatible on the internal interface.

ABORT

This statement may be used to terminate all activity on the external bus and return the HP-IB interfaces of all devices to reset (or power-on) condition. Whether this affects other modes of the device depends on the device itself. The IBASIC program must be either the active or the system controller to perform this function. If it is the system controller and has passed active control to another device, executing this statement causes active control to be returned. Only the interface select code may be specified; primary-addressing information (such as 724) must not be included.
Aborting the Internal Bus
ABORT is not supported for select code 8. Executing ABORT 8 will not generate an error.
Loading...