Keysight (Agilent) 4155B Programmers Guide

Programmer’s Guide
Agilent 4155B Semiconductor Parameter Analyzer
Agilent 4156B Precision Semiconductor Parameter Analyzer
Agilent Part No. 04156-90400
Printed in Japan January 2000
Edition 4
Legal Notice
Copyright © 1997, 1998 Agilent Technologies
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.
2 Agilent 4155B/4156B Programmer’s Guide, Edition 4
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 customers 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 Programmers Guide, Edition 4 3
Printing History
Edition 1: August 1997
Edition 2: September 1997
Edition 3: September 1998
Edition 4: January 2000
Microsoft, Windows, MS-DOS and Excel are registered trademarks of Microsoft Corporation.
Lotus and 1-2-3 are registered trademarks of Lotus Development Corporation.
NFS is a trademark of Sun Microsystems, Inc.
4 Agilent 4155B/4156B Programmers Guide, Edition 4
Programming Overview
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.
Agilent 4155B/4156B Programmers Guide, Edition 4 5
How to Migrate the 4145A/B Programs
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.
6 Agilent 4155B/4156B Programmers Guide, Edition 4
In This Manual
This manual describes how to control the 4155B/4156B by using GPIB commands from an external computer or built-in Instrument BASIC.
This manual consists of the following chapters:
Using Instrument BASIC
4155B/4156B SCPI Command Programming
4155B/4156B FLEX Command Programming
Running 4145A/B Program Directly on 4155B/4156B
ASP-Like IBASIC Programming
Refer to SCPI Command Reference for SCPI commands. And refer to GPIB Command Reference for the FLEX commands and for the 4145 syntax commands.
See User's Guide General Information and User's Guide Measurement and Analysis for information about the 4155B/4156B itself.
Text Conventions
The following text conventions are used in this manual:
key Represents a key physically located on the 4155B/4156B or
exxternal keyboard.
Screen Text Represents text that appears on screen of the 4155B/4156B.
Italic Refers to a related document, or is used for emphasis.
Agilent 4155B/4156B Programmers Guide, Edition 4 7
8 Agilent 4155B/4156B Programmers Guide, Edition 4
Contents
1. Using Instrument BASIC
Before Operating IBASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
To Switch Screen Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
To Use the Help Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Creating and Executing a Simple IBASIC Program . . . . . . . . . . . . . . . . . . . . . . . 1-6
Modifying Program by using Editor Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8
Saving and Getting a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12
Summary of Softkeys and Keyboard Operations for Editor . . . . . . . . . . . . . . . . 1-14
Other Basic Features of IBASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15
Branching/Repeating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15
Subprograms and COM Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16
IBASIC Basic Operation Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-17
IBASIC Editor Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-20
Controlling IBASIC from External Computer . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
IBASIC Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28
All IBASIC Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-29
IBASIC Status Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-31
Keys for IBASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32
Front-panel Keys for IBASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-32
Primary Softkeys in Idle, Pause, Run, or Input? execution status . . . . . . . . . . 1-35
Secondary Softkeys in Idle or Pause execution status . . . . . . . . . . . . . . . . . . . 1-36
Secondary Softkeys in Run or Input? execution status . . . . . . . . . . . . . . . . . . 1-37
Primary Softkeys in Edit execution status . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-37
Secondary Softkeys in Edit execution status . . . . . . . . . . . . . . . . . . . . . . . . . . 1-38
External Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-41
4155B/4156B Specific IBASIC Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-45
Available I/O Resources for IBASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-47
Agilent 4155B/4156B Programmer’s Guide, Edition 4 Contents - 1
Contents
LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-48
GPIB Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-49
Parallel Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-49
Built-in Flexible Disk Drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-50
Differences from 4155A/4156A Programming . . . . . . . . . . . . . . . . . . . . . . . . . 1-51
Using Text Display and Graphics Display . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-52
Using :HCOP:DEST Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-53
Using :HCOP:DEV:LANG Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-54
2. SCPI Command Programming
SCPI Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Preparation before Controlling 4155B/56B via GPIB . . . . . . . . . . . . . . . . . . . 2-3
SCPI Command Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
To Control 4155B/56B by HP BASIC Programming . . . . . . . . . . . . . . . . . . . . 2-6
Getting Started on SCPI Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Creating a Simple Measurement Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Programming for Data Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19
Complete Example Program for Vth Measurement . . . . . . . . . . . . . . . . . . . . 2-24
Example Application Setup for Vth Measurement . . . . . . . . . . . . . . . . . . . . . 2-26
Programming: Measurement Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
To Set or Change 4155/56 Setup Data Values . . . . . . . . . . . . . . . . . . . . . . . . 2-31
To Read 4155/56 Setup Data Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33
Programming: Measurement Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34
To Execute a Sweep or Sampling Measurement . . . . . . . . . . . . . . . . . . . . . . . 2-35
To Force Stress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37
To Start the Knob Sweep Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39
To Control Standby Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-40
Programming: File Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-42
To Store Setup Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-43
Contents - 2 Agilent 4155B/4156B Programmers Guide, Edition 4
Contents
To Store Measurement Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-44
To Load Setup Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45
To Load Measurement Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46
Programming: Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-47
To Read 4155/56 Measurement Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
To Transfer Data to 4155B/4156B (Using User Variable) . . . . . . . . . . . . . . . 2-49
Programming: Print/Plot Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-53
To Output Setup Data to Printer/Plotter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56
To Output Graphics Result Data to Printer/Plotter . . . . . . . . . . . . . . . . . . . . . 2-60
To Output List Results Data to Printer/Plotter . . . . . . . . . . . . . . . . . . . . . . . . 2-63
To Dump Screen Image to Printer/Plotter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-66
To Save Hardcopy Image to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-69
Other Programming Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-70
Disabling Instrument Screen Update to Improve Speed . . . . . . . . . . . . . . . . . 2-70
Auto-loading of Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-71
Differences From 4155A/4156A SCPI Commands . . . . . . . . . . . . . . . . . . . . 2-72
Programming Example for 4145 Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-75
3. FLEX Command Programming
Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Controlling 4155B/4156B via GPIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Controlling 4155B/4156B Using HP BASIC Programming . . . . . . . . . . . . . . . 3-4
High-Speed Spot Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
Spot Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
1 Channel Pulsed Spot Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Staircase Sweep Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Pulsed Sweep Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
Staircase Sweep with Pulsed Bias Measurements . . . . . . . . . . . . . . . . . . . . . . . 3-24
Agilent 4155B/4156B Programmers Guide, Edition 4 Contents - 3
Contents
Sampling Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
Stress Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-32
Controlling PGU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-36
Using Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-39
Reading and Writing Data to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-44
Printing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-53
Reading Binary Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-56
Using the US42 Control Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-60
Programming Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-63
Confirming Operation Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-63
Improving Measurement Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-64
4. Running 4145A/B Program Directly on 4155B/4156B
Non-supported Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Considerations about Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Spot Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Sweep Steps in Logarithmic Step Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
Terminator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
5. ASP-Like IBASIC Programming
Creating ASP-like IBASIC Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Programming Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Reading 4155/56 Data to IBASIC Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
Auto Scaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
4145 ASP and 4155B/4156B Corresponding Keywords . . . . . . . . . . . . . . . . . 5-9
ASP-like Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10
EXECUTE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10
Contents - 4 Agilent 4155B/4156B Programmers Guide, Edition 4
Contents
GET SETUP Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11
SINGLE Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11
STANDBY directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
STRESS Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
AUTO-SCALE Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
SAVE DATA Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13
READ DATA VARIABLE Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
DEFINE USER VARIABLE Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15
PRINT/PLOT Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
CURVE PLOT Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
Agilent 4155B/4156B Programmers Guide, Edition 4 Contents - 5
Contents
Contents - 6 Agilent 4155B/4156B Programmers Guide, Edition 4

1 Using Instrument BASIC

Agilent 4155B/4156B Programmers Guide, Edition 4
Using Instrument BASIC
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.
Differences from 4155A/4156A Programming
1-2 Agilent 4155B/4156B Programmer’s Guide, Edition 4
Using Instrument BASIC

Before Operating IBASIC

Before Operating IBASIC
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:
From instrument front panel, press
From external keyboard, press
Agilent 4155B/4156B Programmers Guide, Edition 4 1-3
Display of IBASIC key group.
Ctrl+G.
Using Instrument BASIC Before Operating IBASIC

To Use the Help Function

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
IBASIC IBASIC 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.
Standard SCPI commands.
Help key while you
1-4 Agilent 4155B/4156B Programmer’s Guide, Edition 4
To move the field pointer
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 keys Field 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.
Agilent 4155B/4156B Programmers Guide, Edition 4 1-5
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 1 Editing
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.
NOTE To 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.
NOTE Always 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.
NOTE Program End
In IBASIC, END must be at end of main program. In above example, line 40 is the last line of the program.
1-6 Agilent 4155B/4156B Programmer’s Guide, Edition 4
Step 2 Exiting from Editor
Select the End edit primary softkey to exit from the editor.
Step 3 Executing Program
To execute the program, press softkey, or type RUN and press screen:
1 2 3 4 5 6 7 8 9 10
NOTE If 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
Creating and Executing a Simple IBASIC Program
Run of the IBASIC key group, select RUN primary
Enter. The following should be displayed on the
Agilent 4155B/4156B Programmers Guide, Edition 4 1-7
Using Instrument BASIC Modifying Program by using Editor Functions

Modifying Program by using Editor Functions

In this section, you can learn the following editor functions:
1. Inserting lines
2. Deleting a line
3. Renumbering
4. Inserting characters
5. Recalling deleted line
6. Indenting
1-8 Agilent 4155B/4156B Programmer’s Guide, Edition 4
Step 1 Inserting Lines
Ty pe EDIT 20, then press
10 FOR I=1 TO 10 20 PRINT I 30 NEXT I 40 END
Select Insert line or press Insert to insert a line above line 20.
10 FOR I=1 TO 10 11 20 PRINT I 30 NEXT I 40 END
Type as follows:
10 FOR I=1 TO 10 11 PRINT I^2 20 PRINT I 30 NEXT I 40 END
I^2 means the second power of I. The above program increments I from 1 to 10, and displays second power of I and I for each step.
Using Instrument BASIC
Modifying Program by using Editor Functions
Enter. Cursor appears at line 20.
Select End edit to exit editor, then press is displayed:
1 1 4 2 9 3 : : 81 9 100 10
Run to execute the program. The following
Agilent 4155B/4156B Programmers Guide, Edition 4 1-9
Using Instrument BASIC Modifying Program by using Editor Functions
Step 2 Deleting 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 3 Renumbering
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:
REN 100, 20
1-10 Agilent 4155B/4156B Programmers Guide, Edition 4
Enter
Step 4 Inserting Characters
Ty pe EDIT 20, then press
10 FOR I=1 TO 10 20 PRINT I^2 30 NEXT I 40 END
Move the cursor by using right key.
10 FOR I=1 TO 10 20 PRINT I^2 30 NEXT I 40 END
Then type I, as follows:
10 FOR I=1 TO 10 20 PRINT I,I^2 30 NEXT I 40 END
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 10 100
Using Instrument BASIC
Modifying Program by using Editor Functions
Enter.
Step 5 Recalling Deleted Line
To restore the most recently deleted line, press
Step 6 Indenting
Move to desired line, then select Indent to indent the line. Indenting makes the program flow easier to understand.
10 FOR I=1 TO 10 20 PRINT I,I^2 30 NEXT I 40 END
Agilent 4155B/4156B Programmers Guide, Edition 4 1-11
Recall front-panel key.
Using Instrument BASIC Saving and Getting a Program

Saving and Getting a Program

The created program can be saved to a diskette. So, you can get the saved program from the diskette, then execute it.
In this section, you can learn the following file operation tasks:
1. Saving a Program
2. Listing Contents of Diskette
3. Clearing a Program
4. Getting a Program
Step 1 Saving a Program
Insert a diskette into the built-in flexible disk drive. Then, type SAVE "filename", then press
Enter. For this example, we will type SAVE "PROG1".
Step 2 Listing Contents of Diskette
Ty pe CAT to list contents of the diskette.
If you are using an MS-DOS format diskette, the display is similar to the following example:
DIRECTORY : \:INTERNAL,4 LABEL: 4156 FORMAT: DOS AVAILABLE SPACE : 5692
FILE NAME TYPE RECS LEN DATE TIME PERMISSION ============ ====== ======= ===== ========= ===== ========== PROG1 DOS 65 1 27-Jun-94 14:30 RW-RW-RW-
FILE NUM REC MODIFIED
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.
1-12 Agilent 4155B/4156B Programmers Guide, Edition 4
Step 3 Clearing a Program
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.
NOTE To 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 4 Getting a Program
Ty pe GET "PROG1", then press Enter. When the LED turns off, enter the editor if you want to display the program.
Agilent 4155B/4156B Programmers Guide, Edition 4 1-13
Using Instrument BASIC Summary of Softkeys and Keyboard Operations for Editor

Summary of Softkeys and Keyboard Operations for Editor

Front-panel keys
Arrow keys Move the cursor
Delete Delete character
Recall Recall most recently deleted line
External Keyboard
Esc Exit editor
F1 to F8 Primary softkeys
Shift+ F1 to F7 Secondary softkeys
F9 Toggle screen mode
F11 Clear to end
Insert Insert line
Delete Delete character at cursor
Shift+Delete Delete line
Home Beginning of line
End End of line
Page Up or Page Down Scroll pages
Primary Softkeys
Back space Delete character before cursor
Insert line Insert line
Delete line Delete line
Re-number Renumber the lines
Indent Indent the line
Scratch Clear program
End edit Exit editor
1-14 Agilent 4155B/4156B Programmers Guide, Edition 4
Using Instrument BASIC

Other Basic Features of IBASIC

Other Basic Features of IBASIC
This section describes the following:
Branching/Repeating
Subprograms and COM Blocks

Branching/Repeating

Branch and Repeat Keywords of IBASIC are shown in the following table:
IBASIC Keyword Function
FOR, NEXT Repeat specified number of times.
IF THEN, ELSE, END IF Branch.
WHILE, END WHILE Repeat until specified condition is false.
REPEAT, UNTIL Repeat until specified condition is true.
Following program tests 1000 devices, and judges them pass or fail.
1 COM Data(1:1000) 2 DIM Id(1:1000) 10 EXECUTE ("GETSETUP 'SAMPL.MES'") 20 FOR I=1 TO 1000 30 EXECUTE ("SINGLE") 40 EXECUTE ("READDATAVAR'Id'") 50 IF Id(I)<1E-6 THEN 60 PRINT "FAIL LOWER" 70 Data(I)=1 80 ELSE 90 IF Id(I)>1E-4 THEN 100 PRINT "FAIL HIGHER" 110 Data(I)=2 120 ELSE 130 PRINT "PASS" 140 Data(I)=0 150 END IF 160 END 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
Agilent 4155B/4156B Programmers Guide, Edition 4 1-15
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.
: : 160 END 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.
1-16 Agilent 4155B/4156B Programmers Guide, Edition 4
Loading...
+ 202 hidden pages