D - Example Programs; Error Handling; Basic Controllers; Example 1. Hp Vectra Pc Controller Using Agilent 82335 Interface - Agilent Technologies 66312A Programming Manual

Dynamic measurement dc source; system dc power supply
Hide thumbs Also See for 66312A:
Table of Contents

Advertisement

D - Example Programs

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 but any secondary address must be specified in the address range
of 96 to 126. 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.

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. Error detection should
be used after every call to a subroutine.

BASIC Controllers

The 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 dc source 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 Appendix C.

Example 1. HP Vectra PC Controller Using Agilent 82335 Interface

5
'-------------------- Merge SETUP.BAS here --------------------
1000
MAX.ELEMENTS=2 :ACTUAL.ELEMENTS=0 :MAX.LENGTH=80 :ACT.LENGTH=0
1005
DIM OUTPUTS(2) :CODES$=SPACE$(40)
1010
ISC=7 :PS=706
1015
'
1020
'Set up the DC Source Interface for DOS driver
1025
CALL IORESET (ISC)
1030
IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR
1035
TIMEOUT=3
1040
CALL IOTIMEOUT (ISC, TIMEOUT)
1045
IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR
1050
CALL IOCLEAR (ISC)
1055
IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR
1060
CALL IOREMOTE (ISC)
mode
1065
IF PCIB.ERR <> NOERR THEN ERROR PCIB.BASERR
1070
'
1075
'Program dc source to CV mode with following voltage and current
1080
CODES$ = "VOLTAGE MAX;CURRENT MAX"
94
'Reset the interface
'Set timeout to 3 seconds
'Clear the interface
'Set dc source to remote
:GOSUB 2000

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

6631b6632b66332a6633b6634b6611c ... Show all

Table of Contents