16 Introduction To Programming
System Considerations
The remainder of this chapter addresses some system issues concerning programming. These are power module addressing
and the use of the following types of GPIB system interfaces:
1. HP Vectra PC controller with Agilent 82335A GPIB Interface Command Library
2. IBM PC controller with National Instruments GPIB-PCII Interface/Handler
3. Agilent controller with Agilent BASIC Language System
Note Some specific application programs are given in Appendix B.
Assigning the GPIB Address in Programs
The power module address cannot be set remotely. It is determined by the position of the mainframe address switch and the
position of power module (slot position) within the mainframe. ( See the Mainframe Users Guide for details.)
The following examples assume that the GPIB select code is 7, the mainframe interface address is 6, and that the power
module address will be assigned to the variable PM3 (power module in the third mainframe slot).
1060 ! Power Module installed in Primary Mainframe
1070 PM3=70602 ! Agilent 82335A Interface
1070 ASSIGN @PM3TO 70602 ! Agilent BASIC Interface
1080 !
1080 ! Power Module installed in Auxiliary Mainframe
1090 PM=70610 ! Agilent 82335A Interface
1090 ASSIGN @PM3 TO 70610 ! Agilent BASIC Interface
For systems using the National Instruments DOS driver, the address is specified in the software configuration program
(IBCONFIG.EXE) and assigned a symbolic name. The address then is referenced only by this name within the application
program (see the National Instruments GPIB documentation).
DOS Drivers
Types of Drivers
The Agilent 82335A and National Instruments GPIB are two popular DOS drivers. Each is briefly described here. See the
software documentation supplied with the driver for more details.
Agilent 82335A Driver. For GW-BASIC programming, the GPIB library is implemented as a series of subroutine calls.
To access these subroutines, your application program must include the header file SETUP.BAS, which is part of the DOS
driver software.
SETUP.BAS starts at program line 5 and can run up to line 999. Your application programs must begin at line 1000.
SETUP.BAS has built-in error checking routines that provide a method to check for GPIB errors during program execution.
You can use the error-trapping code in these routines or write your own code using the same variables as used by
SETUP.BAS.
National Instruments GPIB Driver. Your program must include the National Instruments header file DECL.BAS. This
contains the initialization code for the interface. Prior to running any applications programs, you must set up the interface
with the configuration program (IBCONF.EXE).