Agilent Technologies 66311B Portable Generator User Manual


 
165
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. National Instruments GPIB-PCII Interface/Handler
2. 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 example is for BASIC and assumes that
the GPIB select code is 7, the address is 6, and the dc source is assigned to the variable PS.
1070 ASSIGN @PS TO 706 !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).
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).
Your application program will not include the dc source’s symbolic name and GPIB address. These must
be specified during configuration (when you run IBCONF.EXE). Note that the primary address range is
from 0 to 30. The dc source 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.