20 Remote Programming
DOS Drivers
Types of Drivers
The Agilent 82335A and National Instruments GP-IB 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 GP-IB 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).
Your application program will not include the power supply symbolic name and GPIB address. These must be specified
during configuration (when you run IBCONF.EXE). N ote that the primary address range is from 0 to 30 but any seco ndary
address must be specified in the address range of 96 to 126. The power supply expects a message termination on EOI or
line feed, so set EOI w/last byte of Write. It is also recommended that you set Disable Auto Serial Polling.
All function calls return the status word IBSTA%, which contains a bit (ERR) that is set if the call results in an error. When
ERR is set, an appropriate code is placed in variable IBERR%. Be sure to check IBSTA% after every function call. If it is
not equal to zero, branch to an error handler that reads IBERR% to extract the specific error.
Error Handling
If there is no error-handling code in your program, undetected errors can cause unpredictable results. This includes
"hanging up" the controller and forcing you to reset the system. Both of the above DOS drivers have routines for detecting
program execution errors.
Important Use error detection after every call to a subroutine.
Agilent BASIC Controllers
The Agilent BASIC Programming Language provides access to GPIB functions at the operating system level. This makes it
unnecessary to have the header files required in front of DOS applications programs. Also, you do not have to be concerned
about controller "hangups" as long as your program includes a timeout statement. Because the power supply can be
programmed to generate SRQ on errors, your program can use an SRQ service routine for decoding detected errors. The
detectable errors are listed in Table 5-1 of "Chapter 5 - Error Messages".
Sample Program Code
The following programs are intended only to show how some of the same power supply functions can be programmed to
each of the three previously mentioned GPIB interfaces. The first two are for the DOS interfaces and the third for the
Agilent BASIC interface.