93
D
Example Programs
Introduction
The example programs in this section are intended to show how some of the same dc source
functions can be programmed to each of the following GPIB interfaces:
1. HP Vectra PC controller with Agilent 82335A GPIB Interface Command Library
2. IBM PC controller with National Instuments GPIB-PCII Interface/Handler
3. Agilent controller with BASIC Language System
Assigning the GPIB Address in Programs
The dc source address cannot be set remotely. It must be set using the front panel Address key.
Once the address is set, you can assign it inside programs. The following examples assume that
the GPIB select code is 7, and the dc source is assigned to the variable PS.
1070 PS=706
!Agilent 82335A Interface
1070 ASSIGN @PS TO 706
!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).
Types of DOS Drivers
The Agilent 82335A and National Instruments GPIB are two popular DOS drivers. Each is briefly
described here. See the software documention 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).