Introduction To Programming 17
Your application program will not include the power module 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 but any secondary
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 module 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 "Chapter 5 - Error Messages".
TRANSLATION AMONG LANGUAGES
This section explains how to translate between Agilent BASIC and several other popular programming environments. For
explicit information on initializing interface cards or syntax of language, see the documentation that accompanies your
GPIB interface product.
General Setup Information for GWBASIC
Using the Agilent 82335A/82990A/61062B GPIB Command Library
When CALLs are made to the GPIB Command Library, all parameters are passed as variables.
The address of a module is a real number, determined in the same manner as in Agilent BASIC. For example,
the address 70501 means 7 is the select code of the GPIB interface, 05 is the GPIB address of the mainframe, 01 is
the slot number (secondary address) of the module.
The module expects each command to be terminated by line feed (character 10) and/or EOI. The default
configuration of the GPIB Command Library is carriage return + line feed for end-of-line termination and EOI at
the end of a line. Therefore, the defaults are correct for use with the module.
The GPIB Command Library supports strings, numeric and array data formats. However, multiple data types
cannot be sent in a single command. To send both string and numeric data in one command, convert all numeric
data to strings, concatenate with the string data and send the combined string to the module. To read multiple data
types, read the data into a string, and then manipulate the string by converting each piece into the appropriate data
format.
Error handling is accomplished by checking the variable PCIB.ERR. If it is nonzero, an error has occurred.
See the command library documentation for trapping and interpreting this error variable.