HP-IB Interface Card
National Instruments PCIIA Interface Card
Differences between the HP and National Cards
PROGRAMMING WITH HP INSTRUMENT BASIC
1-2
1
2
3-6
3-4
6
6
6
7-9
7
8
9
10-11
5
6
7
8
PROGRAMMING WITH MICROSOFT QuickBASIC
PROGRAMMING THE HP 4145B AND HP 4142B
MessageBasics
Three Message Types
HP4145B Programming Hints
HP4142B Programming Hints
DifSerences Between
4146B DATA TO ASCII
SAMPLE PROGRAMMbfING DISK
REFERENCES
Progr
amming the HP4146B & HP4142B
12-14
15-22
16
17
18
19-20
21-22
23-24
25-26
27
INTRODUCTION
Today’s research and manufacturing engineers are being pressured to improve productivity while
reducing costs. To remain competitive in the fast-paced electronics marketplace, engineers must reduce
product design cycles. Testing the finished product must be accomplished in the shortest possible time
and in the most repeatable manner. Both of these requirements are causing engineers to rely heavily on
computers to automate the process.
The personal computer is now commonplace on the design engineer’s bench. These powerful machines
feature software packages that allow the novice programmer to quickly analyze devices.
low cost of the personal computer, teamed with the power of custom software, engineers can significantly
speed the development and analysis of their devices.
ABOUT THIS GUIDE
This guide describes how a personal computer can be used to program the HP 4145B Semiconductor
Parameter Analyzer or the HP 4142B Modular DC Source/Monitor via the IEEE 488.2 interface bus.
Many programming fundamentals, examples, and sample programs are provided to get you started and
to help overcome some of the hurdles a first-time programmer faces.
Now with the
There are many different types of computers, software, interface cards, and instrument commands that
we could discuss. However, this guide is not intended to be all inclusive. That is, it is not a tutorial on
HP-IB, programming a personal computer, or the full HP-II3 capability of the instruments. It is intended
to demonstrate the basic concepts of HP-IB communication and provide suf6cient information and
examples to get you started. It is meant to be used with the knowledge contained in the documents listed
in the “Fteferences” Section.
- INTRODUCTION -
CONFIGURATIONS
We will use various combinations of the following configurations in this guide and the dish provided.
Although the example programs and the text are based on Instrument BASIC and QuickBASIC, the text
content can be valuable for programming in other languages.
method of passing information to and from the instruments still apply.
The subroutine calls are the same and the
PC:
Software:
IEEE 488.2
interface cards:
NOTE: The contents of this guide are also applicable to the 4146A.
HP Vectra 336 or IBM/AT (compatible) with 4Mb RAM
HP Instrument BASIC for Windows - E22OOA (Rev A.OO.001
Microsoft QuickBASIC (version 4.51
Microsoft Windows (version 3.01
Hewlett-Packard 82335B HP-B3 card (Windows)
National Instruments GPIB-PCBA card
2
PROGRAM FUNDAMIZNTALS
In this section we are going to discuss the three fundamental parta of a program.
below may help visualize the three steps.
The program flowchart
PROGRAM FLOWCHART
put In output buffer
INITIALIZE
First, initialize the HP-IB interlace and the instrument This step ensures consistent, repeatable
performance of the program. Without these initiahzation procedures, a program may run one time, but
not function properly the next time. This may be due to some setting change made either from the front
panel or HP-B which may drasticaIly change the conf@uration of the instrument Second, configure the
instrument and set the measurement parameters. You must correctly specify the output channels before
proceeding. Finally, specify the acquisition criteria.
-PROGRAMFUNDAMENTALS-
Initializing the HP-IB Interface
CALL IOBESET sets the HP-B3 interface to:
interface timeout = no time limit
interface EOI mode enabled
cr/lf selected as EOL
lf established as the IOMATCH default
CALL IOCLEAR clears the interface by:
terminating any bus communication in progress (UNTalk, UNListen)
clear all serial poll status bits
clear the input and output HP-IB buffers
clear the error queue and key register
stop any measurement or acquisition processes
CALL IOTMEOUT sets an interface timeout value in seconds to handle I/O operations that do not
complete. For example, the HP-B3 cable is not attached or the instrument address is not correct. Once
the HP-IS interface and instrument are initialized, the I/O timeout should be reduced, otherwise the
controller will ‘hang’ if the instrument does not respond. If the instrument does not respond within the
allotted time, the controller will abort the I/O operation and report an error condition. Once again, all
parameters passed to an HP-B3 subroutine are variables. To specify an I/O timeout limit of 10 seconds,
use the following
TIME=10
CALL IOTIMEOUT(ISC,TIME)
Initializing the Instrument
The ‘BST is a common command that resets the HP4142B to a known default configuration.
command will ensure that the instrument is in a known state before configuring it.
command will ensure very consistent, repeatable results. Without the ‘BST, a program may run one
time, but the program may give different results the next time if the instrument is configured differently.
The HP4145B does not have a command to reset the instrument to a known default state. The menus
retain the same values from the previous acquisition unless overwritten.
to specify all setup conditions for each test. The HB4145B boots up with the default configuration.
Specifying the Acquisition
From the front panel of the HP4145B, the acquisition mode is set by pressing the appropriate
measurement key (single, repeat, or append). For the,normal front panel run mode, this is the only
control that needs to be made. When programming the instrument over the bus and using the “MD
command, the acquisition mode is specified by using a 1,2, or 3 respectively.
Therefore, it is very important
Using the ‘BST
Using this
4
CAPTURE
At this point the instrument and interface are completely configured. The trigger command can now be
executed. The trigger command clears the data buffers, acquires data for the requested channels to the
specifications that have been set, and finally stops the acquisition process when complete, displaying the
signal on the HP4145B display.
The HP4145B measurement command is “MD”. The HP414!2B measurement command is “XEY.
However, even though the instrument has been properly initialixed and set up, measurements cannot yet
be made. It must be noted that when the instrument is responding to HP-IB commands, it is in an
interrupt mode, and the data acquisition process is being held off. Changes to the instrument’s
configuration invalidate previously collected data. As a result, if a measurement is requested
immediately, there may not be suf6cient data available to analyxe.
the bus to determine the HP4145B response byte. Serial polling is not required with the HP4142B.
Aquired data must first be sent to the output buffer (automatic with HP414!2B) before being transferred
to the computer or internal disk of the HP4145B.
Gee instrument Operation manuals for details)
The 4145B data format is different from the 4142B.
ANALYZE
Therefore, it may be required to poll
Once the data has been captured, analysis can begin. The HP4145B display capabilities allows you to use
markers, lines, and user functions on the front panel. The data can also be transferred from the buffer
and displayed on the computer, saved to the PC disk drive, or printed to an external device. In the
sample programs, a disk 5le is opened, the measured and source data are written to a file, and the file is
closed.
5
- PROGRAM FUNDAMENTALS -
SAMPLEPROGRAMS
The sample programs on the disk are written for both the HP 4145B and HP 414!2B using both HP
Instrument BASIC and Microsoft QuickBASIC with the HP-IB and National PCIIA interface cards. The
sample programs follow the format of initialize, capture, and analyze as discussed earlier. The
complexity of the programs range from a simple btier dump to an extensive data output handling
routine. Each program has its own comments written into the program which explain each step. You
tan write your own custom program by selecting and modifying these steps.
Both the HP Instrument BASIC and Microsoft QuickBASIC sample programs contain the following
fundamental information:
HEADER INFO:
INITMUZE:
SEND COAtWANDS:
CAPTURE DATA:
TRANSFER DATA:
ANALYZE DATA:
HANDLE ERRORS:
Define global variables and constants; specify include files; call the
various functions.
Initialize HP-IB interface and the instrument; setup the instrument and
measurement parameters.
Send appropriate programming commands to the instrument.
Perform simple parametric measurements.
Bring data from the instrument buffer into the computer.
Display on the computer, store to a PC disk file, or print to an external device.
Include error checking subroutines to report any errors.
DEVICE ADDRESSING WITH THE
HP AND NATIONAL CARDS
HP-IB INTERFACE CARD
The address is composed of two parts:
1. Interface Select Code (IS0
2. Instrument Address
Each interface card has its own ISC address set on the card. This address is used by the subroutine calls
to direct commands and communications to the proper interface. A PC can use multiple interfaces, but
each card must be assigned to a unique ISC. The hardware ISC can be selected, or changed, by using the
switches found on the interface card. Because some address combinations may result in internal
controller bus confhcts, please refer to the installation section of your interface card manual.
Each instrument on the IEEE 433.2 bus also must have a unique address that is between decimal 00 and
30. The instrument address must be set with the bit switches on the back of the HP 4145B and
I-P 4142B as described in their respective Operating manuals.
The factory default values for the ISC address is 7 and the instrument address is 17.
set to 6 in our example programs. Parameters passed to the subroutine calls must be passed as variables.
The reference variable passed to a subroutine call must include not only the device address, but also the
correct interface select code.
DEVICE ADDRESS = (Interface x 100) + Instrument
= (6 x 100) + 17 = 617
I
ADDRESSING
The ISC address is
- DE??fCEADDRESSING WTH THE HPAND NATIONAL CARDS -
NATIONAL INSTRUMENTS PCIIA INTERFACE CARD
The address is composed of two parts:
1. Interface Card Number
2. Instrument Address
Up to four interface cards may be instahed that can handIe up to 32 instrument addresses each.
The card
number is set to 0,1,2, or 3 by a switch on the card. The default card number is 0 for one card instahed.
Instrument addresses default to DEVl, DEV2, . . . .
DEV32 unless otherwise specified. These can be
modified by running the IBCONFBXE 6Ie found in the GPIB-PC directory. When using QuickBasic, the
National card defaults to respond to any instrument address from 0 to 15. The HP 4145B and HP 4142B
factory defauit address is 17. Change the instrument address to something 15 or less or edit the
ICONFEXE file to tell the card to respond to the second block of 16 address (16-31).
The following is an example of the GPIB Device Map. Here we see the name “HP4142B” at address 02,
and “HP4145A” at address 07.
National Instruments
GPIB Device Map GPWC212A Ver 20
Use the cursor keys or mouse to select boarddevices
Use PgUp/PgDn for maps of other boards
Use the function keys to select an action
While OUTPUT and ENTER statements are supported on both HP and National cards, there are a few
subtle differences in the operation of the two classes of cards:
Pressing the “Scroll Lock” key or “Stop” on the control pad aborts any active I/O statement using an HP
card. That won’t work with a National card; to deal with this problem, IBASIC sets a default lo-second
timeout for National cards that are not specifically configured with a timeout in the GPIB.INI flle.
This means that you should NEVER set a timeout of 0 in WIBCONF; this can cause your IBASIC
program to hang indefinitely on I/O statements accessing a National card.
Timeouts work differently on HP and National cards. IBASIC allows you to set timeouts from 0.001 to
32.767 seconds; an HP card uses the exact timeout value specified. However, National cards support
only a discrete set of timeout values: lOus, 3ous, lOOus, . . . ,3os, 100s
To deal with this, IBASIC rounds up to the next higher timeout value for National cards; if you specify a
2.01 second timeout for a National card, it is actually set to 3 seconds. The default timeout is, as shown
in the previous section, set in the WIBCONF utility.
Another difference regarding timeouts is that on an HP card, the timeout applies to each byte. On
National cards, the timeout applies to the entire statement, which may result in a timeout if you are
transferring a large number of bytes and your timeout is too short.
IBASIC supports the following HPIB CONTROL and STATUS registers, relative to the FtMB
implementation; those registers supported by HP cards are marked under the “H”, those supported by
National cards are marked under the “N”.
9
PROGRAMMING WITH HP
INSTRUMENT BASIC
Instrument BASIC for Windows is a complete programming environment designed to provide
measurement results quickly. It provides built-in tools for instrument I/O, graphics, and reporting. It
goes far beyond simply getting measurements from an instrument. I-BASIC provides ail the capability
needed to create simple to complex test programs.
Header Information
Instrument BASIC has unified I/O; in other words, you can communicate with instruments just as if
they were files.
selector with the ASSIGN keyword. You must include an assign statement before any HP-IB commands
are sent.
When using I-BASIC, the HP card is mapped into select code 7 by default and the National card is
mapped into select code 6. We will use select code 6 and the default instrument address of 17 for all the
example programs. Therefore, the device address is 617. (Refer to the Device Addressing sections for
complete details)
To simplify reading and writing, you assign an I/O path to the instrument’s device
ASSIGN @Hp4146 TO 617
Sending Commands
Instrument BASIC gives you powerful commands like OUTPUT and ENTER to set up and get
measurements.
OUTPUT @Hp414S;-BC
Transferring Data to the PC
Instrument BASIC automaticaIly formats data for numbers, strings, and arrays. Use OUTPUT to ask for
an instrument reading.
OUTPUT @Hp4146;PO ‘IB’”
ENTEFt @Hp4146 USING ‘#,S?D,X’;IbO
Use ENTER to read the value from the instrument.
10
- PROGRAhfbfING WITH HP INSTRUMENT BASIC’ -
Storing Data to the PC disk
The default format mode is to read and write tiles in an I-BASIC specific form. To specify a text file, use
the FORMAT ON option.
ASSIGN @File TO ‘Datafile”; FORMAT ON
Handling Errors
Instrument BASIC provides automatic error-checking on all of your code, including I/O commands.
don’t have to worry about hanging up the interfAce and computer. You can also click on the handy
“STOP” button to cancel a program at any time.
To prevent other errors from unexpectedly stopping execution, trap the errors and handle them in your
program. I-BASIC provides many simple to use keywords for error handling.
You
11
Loading...
+ 30 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.