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.
Run and Pause front-panel keys and Ctrl+U (Run) and
Run front-panel key in the IBASIC key
Ctrl+U on external keyboard.
Page 32
Using Instrument BASIC
IBASIC Basic Operation Tasks
Step 3Listing Files
1. Confirm your 4155B/4156B is in the following status:
•the screen is "All IBASIC" screen.
•a program is not executing.
•another command is not executing.
•Editor is not running.
2. Insert a 3.5 inch diskette (that contains the files you want to list) into the built-in
flexible disk drive.
3. Select CAT secondary softkey, then press
The file names on diskette are listed on the screen.
Step 4Retrieving Program
1. Confirm your 4155B/4156B is in the following status:
•the screen is "All IBASIC" screen or "IBASIC Status" screen.
•a program is not executing.
•another command is not executing.
•Editor is not running.
2. Insert the 3.5 inch diskette (that contains the program you want to retrieve) into
the built-in flexible disk drive.
3. Select GET "" secondary softkey.
4. Type in file name to be retrieved. Typed name is inserted after first ".
5. Press
Enter front-panel key, or Enter key on external keyboard.
NOTEExternal disk drive
An external disk drive cannot be connected to the 4155B/4156B. For using a disk
drive connected to external controller, see “Controlling IBASIC from External
Computer” on page 1-24.
1. Confirm your 4155B/4156B is in the following status:
•the screen is "All IBASIC" screen or "IBASIC Status" screen.
•a program is not executing.
•another command is not executing.
•Editor is not running.
2. Insert a 3.5 inch diskette into the built-in flexible disk drive.
3. Select SAVE "" secondary softkey.
4. Type in name of file to which you want to save program.
If the file already exists on the diskette, SAVE cannot be used. If you want to
overwrite an existing file, select RE-SAVE secondary softkey instead of SAVE
secondary softkey in the previous step.
Using Instrument BASIC
IBASIC Basic Operation Tasks
5. Press
Enter front-panel key or Enter key on the external keyboard.
NOTEExternal disk drive
An external disk drive cannot be connected to the 4155B/4156B. For using a disk
drive connected to external controller, see “Controlling IBASIC from External
Computer” on page 1-24.
This section describes the following tasks to use built-in editor of the Instrument
BASIC.
1. Starting the editor
2. Quitting the editor
3. Moving the cursor
4. Inserting characters
5. Deleting character
6. Inserting line
7. Deleting line
8. Scrolling pages
9. Recalling most recently deleted line
Step 1Starting the Editor
1. Confirm the screen is "All IBASIC" screen or "IBASIC Status" screen.
2. Select EDIT secondary softkey.
3. Press
4. If a program is loaded into the 4155B/4156B, the program is displayed.
If you start the editor from the "IBASIC Status" screen, the screen switches to "All
IBASIC" screen, and the editor starts.
Step 2Quitting the Editor
•Select End edit primary softkey.
If you started the editor from the "IBASIC Status" screen, the screen returns from
"All IBASIC" screen to the "IBASIC Status" screen after you quit the editor.
Enter front-panel key or Enter key on the external keyboard.
If you want to start the editor to edit a specific program line, type in the line
number or label of the program line, then press
starts, and cursor is displayed on specified line.
If no program is loaded, 10 is automatically displayed and rest of screen is
empty.
Enter front-panel key. The editor
Page 35
Step 3Moving the Cursor
•To move the cursor, use the following keys.
Direction Front-panel Keyboard
UpÝ key of MARKER/CURSOR groupÝ key
Downß key of MARKER/CURSOR groupß key
RightÞ key of ENTRY groupÞ key
Using Instrument BASIC
IBASIC Editor Tasks
Rotate rotary knob counter-clockwise
Rotate rotary knob clockwise
LeftÜ key of ENTRY groupÜ key
Beginning of LineFAST+ Ü of MARKER/CURSOR groupHome
End of LineFAST+ Þ of MARKER/CURSOR groupEnd
Step 4Inserting Characters
1. Move the cursor to character you want to insert before.
2. Characters you type will be automatically inserted.
3. After you insert characters, you must select the
inserted characters into the program.
Editor is always in insert mode, and cannot be changed to overwrite mode.
To download a program from the external computer to the 4155B/4156B, you need
to use the :PROGram[:SELected]:DEFine command.
The following is an example of an HP BASIC program (running on external
computer) that reads an Instrument BASIC program file (ASCII file stored in a disk
drive connected to external computer) and downloads it to the 4156B.
10OPTION BASE 1
20!
30DIM Line$[1024]
40!
50ASSIGN @Hp4156 TO 717
60!
70OUTPUT @Hp4156;":PROG:DEL:ALL" !Clears program in 4156B
80File_name$="prog"
90ASSIGN @File TO File_name$!Opens file and assigns dat
a path
100OUTPUT @Hp4156;":PROG:DEF #0"!Sends header to 4156B
110ON ERROR GOTO Done
120LOOP
130Line$=""
140ENTER @File;Line$!Reads one program line
150OUTPUT @Hp4156;Line$!Downloads line to 4156B
160END LOOP
170 Done:!
180OFF ERROR
190OUTPUT @Hp4156;Line$
200OUTPUT @Hp4156;" " END
210ASSIGN @File TO *
220END
Using Instrument BASIC
Line
Number
Description
50assigns I/O path to control the 4155B/4156B.
70deletes existing the Instrument BASIC program in the 4155B/4156B.
80name of file (in disk drive of external computer) that contains desired the
Instrument BASIC program
90opens file and assigns data path
100#0 indicates that an indefinite length of parameters (program lines) will be
downloaded
110 to 160reads program lines from the file and downloads them until EOF.
Using Instrument BASIC
Controlling IBASIC from External Computer
Step 3To Upload a Program from the 4155B/4156B
To upload a program from the 4155B/4156B to external computer, you need to use
the :PROGram[:SELected]:DEFine? command.
The following is an example of an HP BASIC program (running on external
computer) that uploads an Instrument BASIC program (ASCII file) from the 4156B
and stores the program on a disk drive that is connected to external computer.
10OPTION BASE 1
20!
30DIM Num_dig$[2]
40INTEGER Byte
50!
60ASSIGN @Hp4156 TO 717
70!
80OUTPUT @Hp4156;":PROG:DEF?"
90ENTER @Hp4156 USING "%,2A";Num_dig$
100PRINT Num_dig$
110!
120Byte=VAL(Num_dig$[2])
130!
140ALLOCATE Data_byt$[Byte]
150!
160FOR I=1 TO Byte
170ENTER @Hp4156 USING "#,A";Data_byt$[I;1] !Enter length of p
rogram
180NEXT I
190!
200D=VAL(Data_byt$)
210PRINT D
220ALLOCATE Prog$[D]
230PRINTER IS CRT;WIDTH D
240ENTER @Hp4156 USING "-K";Prog$!Enter the program
into Prog$
250PRINT Prog$
260ENTER @Hp4156;B$
270PRINT B$
280!
290CREATE "prog",1
300ASSIGN @File TO "prog";FORMAT ON
310OUTPUT @File;Prog$
320ASSIGN @File TO *
330!
340END
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 IBASIC from
this screen mode.
Ctrl+U (Run) and Ctrl+P (Pause) on
Display front-panel key or Ctrl+G (or F9) on external keyboard are used to toggle the
screen display mode as shown in the following figure:
For the "All IBASIC" screen, the entire screen including softkeys is used for
IBASIC. The following describes each part of this screen:
IBASIC Output
Area
Command Entry
Line
System Message
and Display Line
Execution Status This field displays the execution status of IBASIC:
Screen output commands of IBASIC (such as PRINT and OUTPUT 1;) display
characters in this area. This area has 23 lines and 58 columns (58 characters in a
line).
IBASIC command you type is displayed on this line. The length of this line is 58
characters.
For displaying IBASIC error messages and other system messages, and DISP and
INPUT commands of IBASIC.
Idle IBASIC program is stopped. IBASIC commands can be executed.
Run IBASIC program or command is being executed.
Pause IBASIC program is paused.
Input? IBASIC program is waiting for input from front-panel keys or external
For the "IBASIC Status" screen, the two bottom lines are used to display the status
of IBASIC. These two lines are the same as in "All IBASIC" screen. Refer to “All
IBASIC Screen” on page 1-29. Also, the softkeys are for IBASIC.
The other part of the screen is the normal 4155B/4156B screen. This is useful if you
want to view a graph of the measurement results while executing IBASIC program.
ENTRY key group Recall¯ •When the editor is running, this key displays the last deleted
line. To enter this displayed line as part of the program,
press
Enter front-panel key.
•When the editor is not running, this key cycles through the
10 commands that were most recently entered on the
Command Entry line.
Recall
•When the editor is running, this key is same as Recall¯.
•When the editor is not running, this key is same as
Recall
,
¯
but cycles through commands in opposite order.
Save, GetThese keys are ignored.
Other front-panel keys in ENTRY group are available to enter characters on the
Command Entry line or Editor. For the usage of the blue and green front-panel keys
to enter characters, see “All IBASIC Screen” on page 1-29.
Other Keys
HelpDisplays information about IBASIC. And can be used to select
and enter SCPI and IBASIC commands into Editor or
Command Entry line.
Plot/PrintIf present screen is "All IBASIC", dumps "All IBASIC" screen
image to the printer or plotter.
If present screen is "IBASIC Status", prints/plots instrument
part of screen.
Secondary Softkeys in Idle or Pause execution status
This section describes the secondary softkeys that are displayed during the Idle or
Pause execution status.
For the secondary softkeys that are displayed during the Run or Input? status,
refer to “Secondary Softkeys in Run or Input? execution status” on page 1-37.
For the secondary softkeys that are displayed when the editor is running, refer to
“Secondary Softkeys in Edit execution status” on page 1-38.
CAT Clears the Command Entry line, and types in CAT.
To list file names on the diskette, press
SAVE "" 1. Clears the Command Entry line.
2. Types in SAVE " ".
3. Positions the cursor after first ".
To save program to diskette, type name of file to which you want to save program,
then press
Enter.
If file already exists on diskette, program will not be saved.
RE-SAVE "" 1. Clears the Command Entry line.
2. Types in RE-SAVE " ".
3. Positions the cursor after first ".
To save program to diskette, type name of file to which you want to save program,
then press
Enter.
If file already exists on diskette, file will be overwritten, so previous data in file is
lost.
GET "" 1. Clears the Command Entry line.
2. Types in GET " ".
3. Positions the cursor after first ".
Enter.
To get a program from diskette, type name of file to get, then press
To delete a file from diskette, type in the file name to be deleted, then press
EDIT Clears the Command Entry line and types in EDIT. To start the editor, press
front-panel key.
REN umber Clears the Command Entry line and types in REN.
To re-number lines of a program, type in appropriate parameters, then press
For more details about REN command, refer to the Instrument BASIC User's Handbook.
Secondary Softkeys in Run or Input? execution status
When the execution status is Run or Input?, user-defined softkeys, which are
defined by using ON KEY command in the program, are displayed in the secondary
softkey area.
Primary Softkeys in Edit execution status
This section describes the primary softkeys that are displayed when the IBASIC
editor is running (Edit execution status is displayed).
Back space Deletes the character before the cursor.
Insert line Inserts a line between the cursor line and the previous line.
Enter.
Enter
Enter.
Delete line Deletes the cursor line.
Re-number Changes the program line numbers so that first line is 10 and line number increment
is 10.
Indent Indents so that all program lines begin at the same position.
Scratch Clears the program and all variables not in COM. Before clearing, YES and NO
secondary softkeys are displayed for confirmation.
This section describes the secondary softkeys that are displayed when the IBASIC
editor is running (Edit execution status is displayed).
These softkeys help you enter program commands. For commands that require you
to type in some parameters, these softkeys display the command. You must enter the
parameters, then you must press
For commands that do not have parameters, the commands are entered directly into
the program. Commands are entered at the cursor line.
For the EXECUTE command, refer to “EXECUTE” in Chapter 5 for details.
For secondary softkeys that are displayed during Idle or Pause execution status,
refer to “Secondary Softkeys in Idle or Pause execution status” on page 1-36.
For secondary softkeys that are displayed during Run or Input? execution status,
refer to “Secondary Softkeys in Run or Input? execution status” on page 1-37.
In Edit execution status, there are three kinds of secondary softkey menu. To move
to next menu, press MORE secondary softkey.
GET SETUP 1. Displays the following program line for loading a setup file:
Enter key to enter the command into the program.
EXECUTE("GETSETUP ")
2. Positions cursor at second double quotes. You enter the file name to be loaded,
then select
Enter key.
SINGLE Enters the following program line for triggering a single measurement:
EXECUTE("SINGLE")
STANDBY 1. Displays the following program line for changing the operation state of the
standby channels:
EXECUTE("STANDBY ")
2. Positions the cursor at the second double quote. You enter ON or OFF, then
select
Enter key.
STRESS Enters the following program line for triggering stress force:
EXECUTE("STRESS")
AUTO SCALE Enters the following program line for autoscaling:
SAVE DATA 1. Displays the following program line for saving measurement data to a file:
EXECUTE("SAVEDATA ")
2. Positions the cursor at the second double quote. You enter file name to which
you want to save measurement data, then select
Enter key.
READ
DATA
VARIA BL
1. Displays the following program line for reading the values of an 4155B/4156B
data variable, then storing the values into an IBASIC program variable:
EXECUTE("READDATAVAR ,")
2. Positions the cursor at the comma. You enter names of the 4155B/4156B data
DEFINE
USER
VARIA BL
variable and IBASIC program variable, then select
1. Displays the following program line for defining a user variable:
EXECUTE("DEFUSERVAR ,,,")
Enter key.
2. Positions the cursor at the first comma. You enter the user variable name,
number of data, name of IBASIC program variable that contains desired data,
and user variable unit, then select
Enter key.
PRINT/PLOT Enters following program line for printing/plotting the instrument window:
EXECUTE("PRINTPLOT")
CURVE PLOT Enters following program line for printing/plotting a graphics plot of measurement
results:
EXECUTE("CURVEPLOT")
OUTPUT @Hp415x 1. Displays the following program line for outputting a command to the
4155B/4156B:
OUTPUT @Hp415x;""
2. Positions the cursor at the second double quotes. You enter desired command,
then select
Enter key.
ENTER @Hp415x 1. Displays the following program line for entering data from the 4155B/4156B:
ENTER @Hp415x;
2. Positions the cursor after the semicolon. You enter desired variable, then select
PAUSE Enters the following program line for pausing a program:
PAUSE
DISP 1. Displays the following program line for displaying a message:
DISP ""
2. Positions the cursor at the second double quotes. You enter the message that you
want to display, then select
Enter key.
INPUT 1. Displays the following program line for assigning keyboard input to program
variable:
INPUT "",
2. Positions the cursor at the second double quote. Enter string that you want to be
displayed on the screen, and name of variable in which you want to store
keyboard input, then select
Enter key.
IF THEN
ELSE
END IF
1. Displays the following program lines for conditional branching:
IFTHEN
ELSE
END IF
2. Positions the cursor before THEN. Fill in as desired, then select Enter key.
WHILE
END WHILE
1. Displays the following program lines for defining a loop:
WHILE
END WHILE
2. Positions the cursor after WHILE. Fill in as desired, then select Enter key.
FOR NEXT 1. Displays the following program lines for defining a loop:
FOR=TO STEP
NEXT
2. Positions the cursor at =. Fill in as desired, then select Enter key.
When the editor is not running, jumps to the top of the IBASIC output area. Same as
Shift+Home.
Alt+ ßRecall. Same as Shift+Page Up.
Ü, ÞMove cursor. Moves the cursor one character in indicated direction.
Shift+ ÜBeginning of line. Moves the cursor to beginning of line. Same as Home.
Shift+ ÞEnd of line. Moves the cursor to end of line. Same as End.
BackspaceBackspace.
When the editor is running, deletes the character before cursor.
When the editor is not running, deletes the character before cursor (if mode is insert
mode). If mode is not insert move, moves cursor to left by one cursor.
Alt+DDelete line. Same as Shift+Delete.
When the editor is running, deletes the current line.
When the editor is not running, deletes the character at the cursor.
Alt+IInsert line. Same as Insert.
When the editor is running, opens a new line before the current line.
When the editor is not running, inserts text at the cursor (press
Insert again to end
insert mode).
Ctrl+URun. Executes the program.
Ctrl+PPause. Same as Pause. Pauses program execution until CONT is executed or Continue
primary softkey is pressed. If the program is modified while paused, RUN must be
used to restart program execution.
Ctrl+GScreen mode. Same as F9. Toggles the screen mode as follows:
The following keywords are not standard IBASIC keywords, or are standard
keywords, but with a difference. These keywords are specific to the 4155B/4156B.
EXECUTE Not standard IBASIC keyword. Refer to “ASP-like
Commands” in Chapter 5 for details.
ON KEY Standard IBASIC keyword, except the range of key selector is 1
to 7. 1 to 7 of key selector corresponds to secondary softkeys 1
to 7, respectively.
PEN Standard IBASIC keyword, except the range of pen selector is
7. The following table shows the corresponding color for each
pen selector.
pen
selector
1color defined for Foreground on SYSTEM: COLOR SETUP screen.
2color defined for Y1 Axis on SYSTEM: COLOR SETUP screen.
3color defined for Y2 Axis on SYSTEM: COLOR SETUP screen.
4color defined for Marker/Cursor/Line on SYSTEM: COLOR SETUP
screen.
5color defined for Active Mkr/Csr/Lne on SYSTEM: COLOR SETUP
screen.
6color defined for Advisory on SYSTEM: COLOR SETUP screen.
7color defined for Title on SYSTEM: COLOR SETUP screen.
Text can be displayed in the IBASIC output area of "All IBASIC" screen. This area
has 23 lines and 58 columns (58 characters in a line), and does not covers the
softkey display area.
The x and y coordinate values of the area are as follows:
•lower left corner: (x,y)=(0,88)
•upper right corner: (x,y)=(522,479)
The following table shows the area used to display a character. In this table,
Reserved column shows the area captured to display a character. This area covers a
character, and includes space between characters. Actual column shows the area for
a character only.
Lower Left Corner(9 ´ (N-1), 479 -17 ´ M)(9 ´ (N-1), 483 -17 ´ M)
Upper Right Corner(9 ´ N, 479 -17 ´ (M-1))(9 ´ N-4, 476 -17 ´ (M-1))
where, N and M are integer value (N=1 to 58, M=1 to 23).
Graphics display
In "All IBASIC" screen, you can display a graphical plot.
The x and y coordinate values of this area are as follows:
•lower left corner: (x,y)=(0,0)
•upper right corner: (x,y)=(639,479)
This area covers the softkey display area.
GPIB Interfaces
•Internal pseudo GPIB
By using select code 8, you can control the 4155B/4156B via internal pseudo
GPIB interface. The GPIB address of the 4155B/4156B has no meaning, so you
can use any address (0 through 30).
•GPIB on rear panel
You can access GPIB interface on rear panel by using select code 7.
Parallel Interface
You can use parallel interface on the rear panel for the printer interface. Select code
is 9.
Programming differences between the 4155A/4156A and the 4155B/4156B come
from the differences of the screen and the SCPI commands supported by the
instruments.
For the most case, you can execute the IBASIC program created for the
4155A/4156A on the 4155B/4156B built-in IBASIC controller. But the following
programs should be modified to execute on the 4155B/4156B's IBASIC controller.
•Programs use both text display and graphics display.
•Programs use the :HCOPy:DESTination command.
•Programs use the :HCOPy:DEVice:LANGuage command.
This section provides the information to modify the program.
For the SCPI commands which the 4155A/4156A does not support but the
4155B/4156B supports, refer to “Differences From 4155A/4156A SCPI
Commands” in Chapter 2.
NOTEUsing 4155B/4156B FLEX Command Set
If you use the 4155B/4156B FLEX command set, you cannot reuse the SCPI
programs of the 4155A/4156A, and you need to create new program.
Using Instrument BASIC
Differences from 4155A/4156A Programming
Using Text Display and Graphics Display
By the difference of the screen, the 4155B/4156B display area is different from the
4155A/4156A as shown in the following table. So if you execute the IBASIC
program for the 4155A/4156A on the 4155B/4156B built-in IBASIC controller, the
graphics will lie on the text.
Modify the program by using the following information.
4155A/4156A 4155B/4156B
Text display
a
58 characters/line58 characters/line
23 lines23 lines
814 dots/character917 dots/character
Graphics display
b
lower left (0,0)lower left (0,0)
upper right (546,399)upper right (639,479)
a. Text display area does not cover the softkey display area.
b. Graphics display area covers the text display area and the softkey dis-
play area.
Following figure shows the display area image on the 4155B/4156B screen.
The following table shows the area used to display a character. In this table,
Reserved column shows the area captured to display a character. This area covers a
character, and includes space between characters. Actual column shows the area for
a character only.
where, N and M are integer value (N=1 to 58, M=1 to 23).
Reserved Actual
Size (dots)9 ´ 175 ´ 10
Lower Left Corner(9 ´ (N-1), 479 -17 ´ M)(9 ´ (N-1), 483 -17 ´ M)
Upper Right Corner(9 ´ N, 479 -17 ´ (M-1))(9 ´ N-4, 476 -17 ´ (M-1))
Using :HCOP:DEST Command
From differences of the supported interfaces, the command parameters are different
from the 4155A/4156A as shown below:
Model Serial Parallel GPIB LAN file
4155A/4156ASERialRDEViceMMEMory
4155B/4156BPARallelRDEViceNETnMMEMory
where, n is 1, 2, 3 or 4.
The meaning of the parameters is as follows:
SERial Selects serial interface.
PARallel Selects parallel interface.
RDEVice Selects GPIB interface.
NETn Selects a remote printer. n= 1, 2, 3 or 4.
MMEMory Not make hardcopy. Outputs to a file in the device specified by
Standard Commands for Programmable Instruments (SCPI) is a universal
programming language for electronic test and measurement instruments, and based
on IEEE 488.1 and IEEE488.2.
This chapter describes how to create programs that contain SCPI commands to
control Agilent 4155B/56B, and consists of the following sections.
•SCPI Programming Basics
•Getting Started on SCPI Programming
•Measurement Setup
•Measurement Execution
•File Operation
•Data Transfer
•Print/Plot Operation
•Other Programming Tips
•Example for 4145 Users
If you are not familiar with the 4155B/4156B programming, “Getting Started on
SCPI Programming” on page 2-8 provides step-by-step tutorials for programming
and helps you to understand quickly.
In addition to this chapter, Sample Application Programs Guide Book provides some
application examples which are helpful to increase your understanding.
Refer to SCPI Command Reference for the command syntax and description of the
SCPI commands available for the 4155B/4156B.
If you use built-in IBASIC controller to control only the 4155B/4156B, you do not
need to prepare anything before controlling the 4155B/4156B because built-in
IBASIC controller is always connected to the 4155B/4156B via internal GPIB.
However, to control external instruments, do following:
1. Connect the GPIB interface of external instruments to GPIB interface on rear
panel of the 4155B/4156B.
2. Set "4155B/56B is" field on the SYSTEM: MISCELLANEOUS screen to
SYSTEM CONTROLLER.
To use the 4155B/4156B print/plot function, do following:
1. Connect printer/plotter to the 4155B/4156B.
2. If the printer/plotter interface is GPIB:
a. Set "4155B/56B is" field to SYSTEM CONTROLLER before executing
printing/plotting out.
b. Enter the GPIB address of printer/plotter into "GPIB ADDRESS" "HARD
COPY" field on the SYSTEM: MISCELLANEOUS screen.
3. If you use the remote printer connected to the print server:
a. Connect the 4155B/4156B to your LAN.
b. Set the "4155B/56B NETWORK SETUP" table and "NETWORK
PRINTER SETUP" table on the SYSTEM: MISCELLANEOUS screen.
To use the network file system on the NFS server, do following:
1. Connect the 4155B/4156B to your LAN.
2. Set the "4155B/56B NETWORK SETUP" table and "NETWORK DRIVE SETUP" table on the SYSTEM: MISCELLANEOUS screen.
1. Assign I/O path for controlling the 4155B/4156B.
Use ASSIGN command to assign I/O path:
•Built-in IBASIC
Specify select code 8. For the GPIB address, you can use any number
between 0 to 31. Refer to the following example:
10 ASSIGN @Hp415x 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/56B is 17:
10 ASSIGN @Hp415x TO 717
2. Use OUTPUT command to send commands to the 4155B/4156B.
3. Use ENTER command to get query response from the 4155B/4156B.
SCPI Command Programming
Getting Started on SCPI Programming
Getting Started on SCPI Programming
This section provides step-by-step tutorials for programming to control the
4155B/4156B along with programming examples. In this section, you do SCPI
programming by using the built-in IBASIC.
This section consists of the following sections:
•Creating a Simple Measurement Program
This section introduces how to create a measurement program.
•Programming for Data Extraction
This section provides the programming tutorials for data extraction.
•Complete Example Program for Vth Measurement
This section shows complete example program based on the parts described in
the other sections.
•Example Application Setup for Vth Measurement
This section describes an example application setup that you should save to the
file named VTH.MES on diskette before executing program examples (that use
VTH.MES) described in this section.
This section introduces how to create a measurement program.
A simple measurement program created by using built-in IBASIC controller is
provided as an example and you learn step-by-step how to create a measurement
program.
This section consists of the following:
1. Getting a setup file from a diskette and making a measurement
2. Changing the sweep setup parameters
3. Changing the display setup parameters
4. Saving the measurement results to a diskette
5. Printing the measurement results
Before Creating a Program
This section assumes that you have already saved a measurement setup file for Vth
measurement to diskette.
Prepare the diskette and save the measurement setup (described in “Example
Application Setup for Vth Measurement” on page 2-26) to the file named
"VTH.MES" on the diskette.
Before starting this section, do following:
1. If the 4155B/4156B has already been turned on, turn the 4155B/4156B off.
2. Connect a printer to the parallel interface or GPIB interface on the rear panel.
You will use the printer at Step 5.
3. Turn the 4155B/4156B on.
4. Set the SYSTEM: PRINT/PLOT SETUP screen and SCREEN DUMP dialog as
you want. Or set only the "DESTINATION" and "PAPER" fields on the
SYTEM: PRINT/PLOT SETUP screen.
5. If you use the GPIB printer:
a. Set "4155B/56B is" field on the SYSTEM: MISCELLANEOUS screen
to SYSTEM CONTROLLER.
b. Enter the GPIB address of printer/plotter into "GPIB ADDRESS" "HARD
The following table shows the meaning of the parameters:
ParameterDescription
0Dummy parameter (no meaning).
VTH.MESFile name to be loaded.
DISKSource mass storage is diskette.
Then press
Enter. Then select the Insert line softkey.
To Specify Mass Storage Device
When the 4155B/4156B is in the power on state, the mass storage device is set
to the built-in flexible disk drive.
If you specify the device, enter the :MMEM:DEST command before the
:MMEM:LOAD:STAT command. The following parameters are available for
the :MMEM:DEST command:
INTernal Selects the built-in flexible disk drive.
NETn Selects the NFS server. n= 1, 2, 3 or 4.
9. Select OUTPUT @Hp415x secondary softkey.
40 OUTPUT @Hp415x;""
10. Press Help, then press Single, Append, or Repeat to find the command for executing
a measurement.
Relation between the execution keys and commands are shown below:
4. If you do not know the SCPI commands for changing the sweep start and stop
parameters, do as follows:
a. Press IBASIC
b. Press
Meas to change to MEASURE: SWEEP SETUP screen.
Display key until screen display mode is All Instrument mode.
c. Move the field pointer to the parameter that you want to change.
d. Press
Help key.
The corresponding command is displayed at the bottom of the help window:
You need to remember the commands, so that you can enter them in the next
step.
SCPI Command Programming
Getting Started on SCPI Programming
5. Press IBASIC Display key until screen display mode is All IBASIC mode. Then,
do the following to insert the program lines for changing the sweep start and
stop values.
a. Move the cursor to the program line 40.
b. Select Insert line primary softkey.
c. Select the OUTPUT @Hp415x softkey.
d. Type in the SCPI command. Or you can use the help function to enter the
command. For the help function, see “To Use the Help Function” in Chapter
1.
After you finish, the program lines should look as follows:
In this step, change X-axis range of display setup parameters to match the sweep
start and stop values.
SCPI Command Programming
1. Press IBASIC
2. Select EDIT softkey, then press
Display key until screen display mode is All IBASIC mode.
Enter key to start the IBASIC editor.
3. If you do not know the SCPI commands for changing the X-axis parameters, do
as follows:
a. Press IBASIC
b. Press PAGE CONTROL
Display key until screen display mode is All Instrument mode.
Display key to change to DISPLAY: DISPLAY
SETUP screen.
c. Move the field pointer to the parameter that you want to change.
d. Press
Help key.
The corresponding commands are displayed at the bottom of the help
window. You need to remember the commands, so that you can enter them in
the next step.
Command Description
:PAGE:DISP:SET:GRAP:X:MINminimum value of X-axis
:PAGE:DISP:SET:GRAP:X:MAXmaximum value of X-axis
e. Select the EXIT HELP softkey.
4. Press IBASIC
Display key until screen display mode is All IBASIC mode. Then,
do the following to insert the program lines for changing the X-axis display
parameters:
a. Move the cursor to the program line 40.
b. Select Insert line primary softkey.
c. Select the OUTPUT @Hp415x softkey.
d. Type in the SCPI command. Or you can use the help function to enter the
command. For the help function, see “To Use the Help Function” in Chapter
1. After you finish, the program lines should look as follows:
5. Select End edit softkey to exit from the editor.
6. Press IBASIC
7. Press
Run to execute the program.
Display key until screen mode is IBASIC Status mode.
8. Enter the desired sweep start and stop values as prompted. The minimum and
maximum X-axis values of the graph will be the same as these entered values.
:HCOP immediately initiates the plot or print according to the current setup.
After printing is finished, the 4155B/56B returns 1 to the Complete variable,
then "Done" is displayed on the screen.
This section provides the following programming tutorials for data extraction:
1. Reading the 4155/56 setup data
2. Reading values of data variables (measurement results)
3. Transferring data into a file
Step 1Reading 4155/56 Setup Data
To read setup data from the 4155/56 into an IBASIC variable, use the query form of
the corresponding setting command. To make the query form of a command, simply
add a question mark (?) to the end of the command.
Refer to the following program lines of example program:
60 OUTPUT @Hp415x;":PAGE:MEAS:SWE:VAR1:STAR?"
70 ENTER @Hp415x;Vd_start
80 OUTPUT @Hp415x;":PAGE:MEAS:SWE:VAR1:STOP?"
Line 60 This query command tells the 4155B/56B to put the VAR1 start
value in its output buffer.
SCPI Command Programming
Getting Started on SCPI Programming
:PAGE:MEAS:SWE:VAR1:STAR is the command for setting
the VAR1 start value. By adding ?, the command becomes the
query command for reading the VAR1 start value.
Line 70 This gets the start value from the output buffer, then enters it in
the Vd_start variable.
Line 80 to 90 These lines tell the 4155B/56 to put VAR1 stop value in its
output buffer, then the value is entered into the Vd_stop
variable.
SCPI Command Programming
Getting Started on SCPI Programming
Step 2Reading 4155/56 Measurement Data
To read read-out function values or data variable values (output data, measurement
data, and user function values) from the 4155/56 to IBASIC variables, use the
:DATA? command.
Refer to the following program lines in the example program:
410 OUTPUT @Hp415x;":PAGE:SCON:MEAS:SING"
420 OUTPUT @Hp415x;"*OPC?"
430 ENTER @Hp415x;Complete
440 OUTPUT @Hp415x;":DATA? 'VTH'"
450 ENTER @Hp415x;Vth
Line 410 Execute single measurement.
Line 420 to 430 Wait for measurement completion.
Line 440 Send :DATA? query command to read the result value of user
function "VTH".
Line 450 Store the result value into Vth variable.
NOTEVariable Names
Be aware that data variable names, such as user functions and user variables, are
case sensitive. For example, if you set up user function name VTH on the
CHANNEL: USER FUNCTION DEFINITION screen, then to read it, you must use
:DATA? 'VTH', not :DATA? 'Vth'.
Step 3Transferring Specific 4155/56 Data to a File
To transfer data from the 4155B/56B to a file, do as follows:
1. Create a data file.
2. Open an I/O path for transferring data into the file.
3. Store data into the file.
4. Close the I/O path.
Create a data file
You can create three types of data files: DOS, LIF ASCII, or BDAT as follows:
CREATE "data_file",1! Creates a DOS file.
CREATE ASCII "ascii_file",100! Creates a LIF ASCII file.
CREATE BDAT "binary_file",100! Creates a BDAT file.
DOS files are compatible with MS-DOS, which are easy to transfer to PCs and other
computers.
LIF ASCII files are compatible with HP computers that support this file type, so this
type is best is you are transferring files among HP computers that support this file
type.
SCPI Command Programming
BDAT (binary data) files provide more flexibility (can specify both number of
records and record length) and faster transfer rate. But BDAT files cannot be
interchanged with as many other systems.
The first parameter of each statement specifies the file name to create.
The second parameter specifies number of records to allocate for the file as follows:
DOS Second parameter specifies how many records are to be initially
allocated for the file. A DOS file system automatically allocates
additional space for the file as new data is written to it, so you
can always specify 1 for this parameter.
LIF ASCII Second parameter specifies total number of records to allocate
for the file, so you must specify a sufficient number of records.
The length of one record is 256 bytes.
For example, the following statement would create a file with
100 records (each record is 256 bytes):
SCPI Command Programming
Getting Started on SCPI Programming
BDAT Second parameter specifies total number of records to allocate
for the file, so you must specify a sufficient number of records.
You can specify a record length by using an optional third
parameter (default length is 256 bytes).
For example, the following statement creates a file with 7
records (each record is 128 bytes):
CREATE BDAT "B_file",7,128
The following statement creates a file with 7 records (each
record is 256 bytes):
CREATE BDAT "B_file",7
Open an I/O path for transferring data into the file
To open an I/O path to the file, assign an I/O path name to the file by using an
ASSIGN statement as in the following example:
340 INPUT "Enter file name to store data",File$
350 CREATE File$,1
360 ASSIGN @File TO File$;FORMAT ON
Line 350 creates a DOS file, then line 360 opens an I/O path to the file.
For DOS and BDAT files, ASSIGN statement can also specify the following:
FORMAT ON ASCII data representations are used. Specify this if you need to
transport data between IBASIC and other machines.
FORMAT OFF IBASIC internal data representations are used. Specify this if
you need a faster transfer rate and space efficiency.
Store data into the file
To store data into a file, use OUTPUT and ENTER statements as in the following
examples:
340 INPUT "Enter file name to store data",File$
350 CREATE File$,1
360 ASSIGN @File TO File$;FORMAT ON
SCPI Command Programming
Getting Started on SCPI Programming
Complete Example Program for Vth Measurement
The example program shown below uses the measurement setup file described in
“Example Application Setup for Vth Measurement” on page 2-26. This is a
complete example program based on the parts described in the previous sections.
10COM @Hp415x
20ASSIGN @Hp415x TO 800
30OUTPUT @Hp415x;":MMEM:LOAD:STAT 0,'VTH.MES','DISK'"
40!
50! Read and Disp. Measurement Conditions
60OUTPUT @Hp415x;":PAGE:MEAS:SWE:VAR1:STAR?"
70ENTER @Hp415x;Vd_start
80OUTPUT @Hp415x;":PAGE:MEAS:SWE:VAR1:STOP?"
90ENTER @Hp415x;Vd_stop
100OUTPUT @Hp415x;":DISP:ALL BAS"
110CLEAR SCREEN
120PRINT TABXY(1,1);"Vd START=";Vd_start;"(V)"
130PRINT TABXY(1,2);"Vd STOP =";Vd_stop;"(V)"
140!
150! Parameter Change
160Change$="n"
170 Change:!
180INPUT "Change these parameters? (y/n default=n)",Change$
190SELECT Change$
200CASE "Y","y"
210INPUT "New Vd START (V)?",Vd_start
220INPUT "New Vd STOP (V)?",Vd_stop
230OUTPUT @Hp415x;":PAGE:MEAS:SWE:VAR1:STAR ";Vd_start
240OUTPUT @Hp415x;":PAGE:MEAS:SWE:VAR1:STOP ";Vd_stop
250PRINT TABXY(1,1);"Vd START=";Vd_start;"(V)"
260PRINT TABXY(1,2);"Vd STOP =";Vd_stop;"(V)"
270CASE "N","n"
280GOTO Store_file
290CASE ELSE
300GOTO Change
310END SELECT
320!
330 Store_file:!
340INPUT "Enter file name to store data",File$
350CREATE File$,1
360ASSIGN @File TO File$;FORMAT ON
370!
380No_of_data=0
390REPEAT
400OUTPUT @Hp415x;":DISP:ALL BST"
410OUTPUT @Hp415x;":PAGE:SCON:MEAS:SING"
420OUTPUT @Hp415x;"*OPC?"
430ENTER @Hp415x;Complete
440OUTPUT @Hp415x;":DATA? 'VTH'"
450ENTER @Hp415x;Vth
460OUTPUT @File;Vth
470No_of_data=No_of_data+1
480OUTPUT @Hp415x;":DISP:ALL BASIC"
490PRINT TABXY(1,10);"Last measured Vth =";Vth;"(V)"
500PRINT TABXY(1,11);"Total number of die tested=";No_of_
data
510 Stop_query:INPUT "Continue to next die or Stop test? (c/s)"
,Stop$
520SELECT Stop$
530CASE "C","c"
540DISP "Move to the next die, then press [Continue]"
550PAUSE
560DISP ""
570CASE "S","s"
580PRINT TABXY(1,24);"Test Stopped!!"
590ASSIGN @File TO *
600CASE ELSE
610GOTO Stop_query
620END SELECT
630UNTIL Stop$="S" OR Stop$="s"
640END
SCPI Command Programming
Getting Started on SCPI Programming
Example Application Setup for Vth Measurement
This section describes an example application setup that you should save to the file
named VTH.MES on diskette before executing program examples (that use
VTH.MES) described previously in this section.
A frequently used method of measuring Vth is to synchronously sweep the exact
same voltage to gate and drain, and measure the characteristics in the saturation
region.
The theoretical value of drain current in the saturation region is calculated as
follows:
Id = b ´ ( Vg - Vth )
Where b is the gain factor, which is -1/2 ´ ( meox W/L) ´ tox. Therefore, if you take
the square root of both sides of the equation:
ÖId
= Öb ´ (Vg - Vth)
ÖId
is proportional to Vg, and the slope is Öb. At the point where ÖId is equal 0, Vth
is equal to Vg. So, to know Vth, we need to find that point.
SCPI Command Programming
Getting Started on SCPI Programming
CHANNELS: USER FUNCTION DEFINITION
The following setup is necessary to calculate SQRTId (square root of Id), and
GRAD (differential coefficient of SQRTId) versus Vg automatically. VTH and
BETA are defined to extract Vth and b automatically by using the Read Out
Functions and the Auto Analysis Functions. VTH is @L1X (X-intercept of line 1)
and BETA is @L1G^2 (slope of line 1 to second power). Line 1 is drawn according
to the definitions of the DISPLAY: ANALYSIS SETUP screen.
The following setup is to plot two curves: SQRTId versus Vg, and GRAD versus
Vg. And VTH and BETA will be displayed in the data variables display area.
•GRAPHICS
X-axisY1-axisY2-axis
NAMEVgSQRTIdGRAD
SCALELINEARLINEARLINEAR
MIN0 V00
MAX5 V200 m80 m
•GRID
ON
•LINE PARAMETER
ON
•DATA VARIABLES
VTH
BETA
DISPLAY: ANALYSIS SETUP
The Auto Analysis Functions are defined on DISPLAY: ANALYSIS SETUP screen.
A tangent line (line 1) is drawn to "SQRTId versus Vg" curve (Y1) at point where
GRAD is maximum. VTH is the X-intercept of this line. Also, the marker is moved
to point where GRAD is maximum.
* LINE1TANGENTline on Y1at a point where
GRAD=MAX(GRAD)
If you execute a single measurement, the two curves are drawn. Right after the
measurement, a tangent line is drawn as specified in DISPLAY: ANALYSIS SETUP
screen, and resulting VTH and BETA values are displayed.
To set up a measurement, you can use SCPI commands to set the setup screens of
the 4155B/4156B the same way that you can by interactive operation.
Basically, there are the following three ways to set up a measurement via SCPI
programming:
•Load the measurement setup data from diskette, NFS server or internal memory.
Load the measurement setup data by SCPI programming. The data was
previously defined and stored to the mass storage memory interactively or by
SCPI programming.
•Load the measurement setup data, then change some of the settings.
Load the measurement setup data from the mass storage memory, then change
desired settings by SCPI programming.
•Set all settings.
Set all settings for measurement setup by SCPI programming.
This section describes the following tasks:
•To set or change setup data values.
•To read setup data values
To load previously defined measurement setup data, refer to “Programming: File
Operation” on page 2-42.
Send :PAGE subsystem commands that correspond to the setup data values that you
want to change or set.
There is a command subsystem for each setup screen as shown in the following
table. Each command subsystem has commands for setting the setup data of the
corresponding setup screen.