This document contains information which is protected by copyright. All rights are
reserved. Reproduction, adaptation, or translation without prior written permission
is prohibited, except as allowed under the copyright laws.
•Product Warranty
Agilent Technologies warrant Agilent Technologies hardware, accessories and
supplies against defects in materials and workmanship for the period of one year
from the warranty start date specified below. If Agilent Technologies receive
notice of such defects during the warranty period, Agilent Technologies will, at
its option, either repair or replace products which prove to be defective.
Replacement products may be either new or like-new.
Warranty service of this product will be performed at Agilent Technologies.
Buyer shall prepay shipping charges to Agilent Technologies and Agilent
Technologies shall pay shipping charges to return the product to Buyer.
However, Buyer shall pay all shipping charges, duties, and taxes for products
returned to Agilent Technologies from another country.
Agilent Technologies do not warrant that the operation of Agilent Technologies
products will be uninterrupted or error free. If Agilent is unable, within a
reasonable time, to repair or replace any product to a condition as warranted,
customer will be entitled to a refund of the purchase price upon prompt return of
the product.
The Agilent Technologies products may contain remanufactured parts
equivalent to new in performance or may have been subject to incidental use.
The warranty period begins on the date of delivery or on the date of installation
if installed by Agilent Technologies. If customer schedules or delays Agilent
Technologies installation more than 30 days after delivery, warranty begins on
the 31st day from delivery.
Warranty does not apply to defects resulting from (a) improper or inadequate
maintenance or calibration, (b) software, interfacing, parts or supplies not
supplied by Agilent Technologies, (c) unauthorized modification or misuse, (d)
operation outside of the published environmental specifications for the product,
or (e) improper site preparation or maintenance.
To the extent allowed by local law, the above warranties are exclusive and no
other warranty or condition, whether written or oral, is expressed or implied and
Agilent Technologies specifically disclaim any implied warranties or conditions
of merchantability, satisfactory quality, and fitness for a particular purpose.
Agilent Technologies will be liable for damage to tangible property per incident
up to the greater of $300,000 or the actual amount paid for the product that is the
subject of the claim, and for damages for bodily injury or death, to the extent
that all such damages are determined by a court of competent jurisdiction to
have been directly caused by a defective Agilent Technologies product.
To the extent allowed by local law, the remedies in this warranty statement are
customer’s sole and exclusive remedies. Expect as indicated above, in no event
will Agilent Technologies or its suppliers be liable for loss of date or for direct,
special, incidental, consequential (including lost profit or date), or other damage,
whether based in contract, tort, or otherwise.
For consumer transactions in Australia and New Zealand: the warranty terms
contained in this statement, except to the extent lawfully permitted, do not
exclude, restrict or modify and are in addition to the mandatory statutory rights
applicable to the sale of this product to you.
•Assistance
Product maintenance agreements and other customer assistance agreements are
available for Agilent Technologies products.
For any assistance, contact your nearest Agilent Technologies Sales Office.
•Certification
Agilent Technologies Inc. certifies that this product met its published
specifications at the time of shipment from the factory. Agilent further certifies
that its calibration measurements are traceable to the National Institute of
Standards and Technology (NIST), to the extent allowed by the Institute’s
calibration facility, and to the calibration facilities of other International
Standards Organization members.
Agilent 4155B/4156B can be fully controlled from an external computer or by using
built-in Instrument BASIC (IBASIC) controller. IBASIC is a programming
environment that allows full control of the 4155B/4156B without using an external
computer.
The 4155B/4156B has three command modes:
•4155/4156 SCPI command mode
SCPI means Standard Commands for Programmable Instruments. This mode is
the default mode of the 4155B/4156B, and allows you to control all functions of
the 4155B/4156B.
•4155/4156 FLEX command mode
FLEX means Fast Language for EXecution. This mode allows you to control
measurement functions of the 4155B/4156B. Command execution is faster than
the SCPI command mode.
•4145 syntax command mode
This mode allows you to execute the 4145A/B programs on the 4155B/4156B
directly with little or no modification. In this command mode, you cannot
control all functions of the 4155B/4156B.
The 4145A/B Auto Sequence Program (ASP) programs run on the 4145A/B built-in
programming environment and allow basic control of the 4145A/B without using an
external computer. To run the ASP programs on the 4155B/4156B, you do one of
the following and execute the program in the 4155/4156 SCPI command mode:
•Create a program that performs the same operations as the desired ASP program
by using the IBASIC editor typing aid softkeys to enter commands that
correspond to each ASP command. This program can run on IBASIC only, not
on an external computer. Refer to Chapter 5 for details.
•Create a program using SCPI commands that performs same operations as the
desired ASP program. This program can run on IBASIC or on an external
computer. Refer to “Programming Example for the 4145 Users” in Chapter 2 for
details.
The 4145A/B GPIB programs run on an external computer and allow full control of
the 4145A/B. To run these programs on the 4155B/4156B, do one of the following:
•Directly run the 4145A/B program on the 4155B/4156B with little or no
modification. You must run this program in the 4145 syntax command mode
from IBASIC or an external computer. Refer to Chapter 4 for details.
•Create a program using SCPI commands that performs same operations as the
4145A/B program. You must run this program in the 4155/4156 SCPI command mode from IBASIC or an external computer.
•Create a program using FLEX commands that performs same operations as the
4145A/B program. You must run this program in the 4155/4156 FLEX command mode from IBASIC or an external computer.
The Instrument BASIC (IBASIC) is a system controller built into Agilent
4155B/4156B. By using IBASIC, you can run a program to control the
4155B/4156B and other instruments (connected via interfaces of the 4155B/4156B)
without using an external computer.
IBASIC is a subset of HP BASIC. Programs created by IBASIC can run on an HP
BASIC controller with little or no modification.
This chapter consists of the following sections.
The following sections provide step-by-step instructions to operate IBASIC by
using examples. You can learn the basics of IBASIC programming and operations.
If you are not familiar with IBASIC, we recommend to read through these sections
first.
•Before Operating IBASIC
•Creating and Executing a Simple IBASIC Program
•Modifying Program by using Editor Functions
•Saving and Getting a Program
•Summary of Softkeys and Keyboard Operations for Editor
•Other Basic Features of IBASIC
The following sections are a task oriented reference for IBASIC. You can quickly
find the desired IBASIC task.
•IBASIC Basic Operation Tasks
•IBASIC Editor Tasks
•Controlling IBASIC from External Computer
The following sections provide the reference information of IBASIC.
•IBASIC Screen
•Keys for IBASIC
•4155B/4156B Specific IBASIC Commands
•Available I/O Resources
The following section provides the differences from the 4155A/4156A IBASIC
programming.
The 4155B/4156B provides the following three screen modes for operating IBASIC.
•"All IBASIC" screen
Entire screen including softkeys is used for IBASIC, so no instrument setup
screen is displayed.
You can execute programs, but no instrument setup screen appears in this mode.
•"IBASIC Status" screen
Softkeys and bottom two lines are used for IBASIC. Rest of screen is for
instrument setup screen.
In this mode, you can start the IBASIC editor. The displayed softkeys are for
IBASIC operation. You can execute IBASIC commands interactively.
Characters you type are displayed at the bottom of the screen.
•"All Instrument" screen
.This is regular instrument screen and the default display mode at power on.
Entire screen is for instrument setup screen, and all softkeys are for interactive
use of instrument. In this mode, you cannot use the IBASIC editor. Only the
front-panel keys of IBASIC key group and
external keyboard are available to execute or pause program for the Instrument
BASIC from this screen mode.
Ctrl+U (Run) and Ctrl+P (Pause) on
For details about the Instrument BASIC screens, refer to “IBASIC Screen” on page
1-28.
To Switch Screen Mode
To switch the screen mode, repeat one of the following instruction until the desired
screen is displayed. This operation toggles screen display as shown below:
By using the built-in help function of the 4155B/4156B, you can easily get
information (name, syntax, and description) about programming commands, and
can enter the desired command into the program without typing.
To start the help function for the programming commands, press
are in the IBASIC editor.
In the help function, the programming commands are divided into the following
three categories, which you can access by secondary softkeys.
Softkey Category
IBASICIBASIC commands.
PA G E
IMAGE
COMMAND
SCPI
COMMAND
The upper part of the help screen displays a list of the command names. The lower
part displays a description of the selected (by field pointer) command.
There are no Help function for the 4155/4156 FLEX command mode and the 4145 Syntax command mode.
SCPI commands specific for the 4155B/4156B. These are the
help commands associated with the instrument setup screen
that begin with :PAGE.
To move the field pointer, refer to the following table:
Using Instrument BASIC
Before Operating IBASIC
Rotary knob or
Arrow keys
PAGE CONTROL
keys
MEASUREMENT
keys
Get and Save
Basically, you move the field pointer by using the rotary
knob or arrow keys.
Field pointer moves to first PAGE IMAGE command that
is associated with the pressed key. PAGE CONTROL keys
are
Chan, Meas, Display, Graph/List, Stress, and System.
Field pointer moves to the PAGE IMAGE command that
is associated with the pressed key. MEASUREMENT keys
Single, Repeat, and Append.
are
Field pointer moves to the associated SCPI command.
front-panel keys
Alphabetical keysField pointer moves to next command that has a keyword
that begins with same letter as the pressed key. If you are
in the PAGE IMAGE command category, search is only
within the instrument screen group of the currently
selected command.
To search for a command
To search for a command:
1. Press SEARCH secondary softkey.
2. Type in command string that you want to search for, then press
Enter
To enter a command into the editor
The command specified by the field pointer is displayed on the entry line. If you
Enter, the command is entered into the editor.
press
If command specified by the field pointer is a PAGE IMAGE or SCPI command,
first select the OUTPUT @Hp415x secondary softkey. The entry line becomes
OUTPUT @Hp415x;"command", where command is command specified by field
pointer. Then, press
Enter.
OUTPUT @Hp415x;"command" is entered into the editor.
Using Instrument BASIC
Creating and Executing a Simple IBASIC Program
Creating and Executing a Simple IBASIC
Program
In this section, let's try to create and execute a simple program.
Before creating a program in the IBASIC editor, first change the screen display
mode to IBASIC Status screen mode or All IBASIC screen mode by pressing
IBASIC
following sections, the All IBASIC screen display mode is used.
1. Editing
2. Exiting from Editor
3. Executing Program
Step 1Editing
Select EDIT secondary softkey or type EDIT, then press
10
The following program prints the numbers from 1 to 10. Type as follows:
10 FOR I=1 TO 10
20 PRINT I
30 NEXT I
40 END
Display key as described in “To Switch Screen Mode” on page 1-3. In
Enter.
NOTETo start the editor at a specific program line or label
Ty pe EDIT linenum or EDIT label.
For example, if you type EDIT 30, the cursor appears at line 30. If you do not
specify a line number or label, the cursor will appear at line 10.
NOTEAlways insert mode
Editor is always in insert mode, and cannot be changed to overwrite mode. If you
typed wrong characters, use
Backspace to move back a character, or move cursor
using Ü key, then use Delete to delete a character. Then type correct characters.
NOTEProgram End
In IBASIC, END must be at end of main program. In above example, line 40 is the
last line of the program.
Select the End edit primary softkey to exit from the editor.
Step 3Executing Program
To execute the program, press
softkey, or type RUN and press
screen:
1
2
3
4
5
6
7
8
9
10
NOTEIf an error message appears
If an error message appears, you probably typed wrong characters. The error
message indicates the line number where the error occurs. You need to modify the
line.
Using Instrument BASIC
Modifying Program by using Editor Functions
Step 2Deleting a Line
Ty pe EDIT 20 to start editor at line 20.
10 FOR I=1 TO 10
11 PRINT I^2
20 PRINT I
30 NEXT I
40 END
Then, select Delete line or press Shift+Delete to delete line 20. The result is as
follows:
10 FOR I=1 TO 10
11 PRINT I^2
30 NEXT I
40 END
The above program increments I from 1 to 10, and displays the second power of I at
each step.
If you exit editor and execute the program, the following is displayed:
1
4
9
:
:
81
100
Step 3Renumbering
In above example, line numbers are not in equal increments. To change the line
number increment to 10, select Re-number softkey. Line numbers will be changed
as follows:
10 FOR I=1 TO 10
20 PRINT I^2
30 NEXT I
40 END
If you use the Re-number softkey, the renumbering is always as follows: first line is
10 and the increment is 10.
If you desire other numbering, you need to exit the editor, and use the REN
command. For example, if you want first line number to be 100 and increment to be
20, type as follows:
Above program increments I from 1 to 10, and displays I and the second power of I
on one line at each step. Exit editor, then execute the program. The following is
displayed:
11
24
39
::
::
981
10100
Using Instrument BASIC
Modifying Program by using Editor Functions
Enter.
Step 5Recalling Deleted Line
To restore the most recently deleted line, press
Step 6Indenting
Move to desired line, then select Indent to indent the line. Indenting makes the
program flow easier to understand.
You can also check the contents of the diskette by using the filer (SYSTEM: FILER
screen) of the 4155B/4156B. But you cannot save and get the IBASIC programs by
using the filer.
To clear the program, enter the editor, then select Scratch softkey. Then, select Yes
secondary softkey.
Existing program will be cleared, and following is displayed:
10 COM @Hp415x
20 ASSIGN @Hp415x TO 800
30!
9990 END
COM @Hp415x and ASSIGN @Hp415x TO 800 are used to control the
4155B/4156B as follows.
•COM @Hp415x
Declares COM so that subprograms can access the I/O path (that is assigned in
line 20) for controlling the 4155B/56B. Refer to the Instrument BASIC Users Handbook for details.
•ASSIGN @Hp415x TO 800
Assigns the I/O path for controlling the 4155B/56B. 800 means built-in
IBASIC controller.
Using Instrument BASIC
Saving and Getting a Program
Refer to “Subprograms and COM Blocks” on page 1-16.
NOTETo ASSIGN I/O path
•Built-in IBASIC controller
Specify select code 8. For the GPIB address, you can use any number between 0
to 31. Refer to the following example:
10 ASSIGN @Hp4155 TO 800
•HP BASIC on an external computer
Specify the select code of the external computer. And specify the GPIB address
that you entered into the GPIB ADDRESS field on the SYSTEM:
MISCELLANEOUS screen. In the following example, the select code of the
external computer is 7 and GPIB address of the 4155B/4156B is 17:
10 ASSIGN @Hp4155 TO 717
Step 4Getting a Program
Ty pe GET "PROG1", then press Enter. When the LED turns off, enter the editor if
you want to display the program.
Using Instrument BASIC
Other Basic Features of IBASIC
Subprograms and COM Blocks
One of the most powerful constructs available is the subprogram. A subprogram has
its own "context" or state that is distinct from the main program and all other
subprograms. There are several benefits of subprograms.
•The subprogram allows you to take advantage of the "top-down design" method
of programming.
•You can remove all subtasks from the overall logic flow of the main program.
•You can debug the program by testing each subprogram independently.
•The subprograms can be used to reduce the overall size of the program.
•Libraries of commonly used subprograms can be assembled for widespread use.
Refer to the example program in the previous section. Line 180 calls a subprogram
to store data into a DOS file.
:
:
160END IF
170NEXTI
180 CALL Save_data
190 END
200!
210 SUB Save_data
220 COM Data(*)
230 CREATE "data_file",1
240 ASSIGN @File TO "data_file";FORMAT ON
250 OUTPUT @File;Data(*)
260 ASSIGN @File TO *
270 SUBEND
COM blocks
COM blocks are used by the subprogram to communicate with the main program or
with other subprograms.
If you create subprograms and want to use common variables between main
program and subprograms, you should use COM blocks.
Refer to the above example.
In the main program, line 1 declares that the Data array will be a COM array. Then,
the main program assigns values to this array. Line 220 specifies that the
subprogram Save_data will also use the Data array. So, Data array of main
program can be operated on in the Save_data subprogram.