GPIB Operation
|
|
Some Additional
Driver Calls
18
1-99
100
110
120
130
140
150
160
170
180
190
200
210
25O
260
<DECL.BAS>
DEV$=" DEV4"
CALL IBFIND(DEV$,SCOPE%)
CMD$="TDIV?"
CALL IBWRT(SCOPE%,CMD$)
IF ISTA% < 0 THEN GOTO 200
CALL IBRD(SCOPE%,RD$)
IF ISTA% < 0 THEN GOTO 250
PRINT RD$
IBLOC(SCOPE%)
END
PRINT "WRITE ERROR = ";IBERR%
END
PRINT "READ ERROR = ";IBERR%
END
The GPIB status word ISTA%, the GPIB error variable IBERR%
and the count variable IBCNT% are defined by the GPIB handler
and are updated with every GPIB function call. Refer to the Na-
tional Instruments user’s manual for details. The sample program
above would report if the GPIB address of the instrument was set
to a value other then 4. Line 180 resets the instrument to local with
a call to the GPIB routine IBLOC.
Example 2 in Appendix A provides a more useful program which
enables interactive setting and inspection of the front-panel con-
trois as well as archiving and recalling of waveforms. Note that this
program is written with just 7 different GPIB calls.
IBLOC is used to execute the IEEE 488.1 standard message Go
To Local (GTL), i.e. it returns the instrument to the local state.
The programming example above shows its use.
IBCLR executes the IEEE 488.1 standard message Selected De-
vice Clear (SDC).
IBRDF and IBWRTF allow data to be read from GPIB to a file
and data to be written from a file to GPIB respectively. Transfer-
ring data directly to or from a storage device does not limit the size
of the data block, but it may be slower than transferring to the
computer memory. Example 2 in Appendix A shows the use of
these calls.
IBRDI and IBWRTI allow data to be read from GPIB to an inte-
ger array and data to be written from an integer array to GPIB.
Since the integer array allows storage of up to 64 kilobytes (in BA-
SIC), IBRDI and IBWRTI should be used for the transfer of large
I
II
l
I
il
II
n
l
ii
m
ii
il
II
n
ti
II