IBM 7220 Car Amplifier User Manual


 
C-3
Appendix C, DEMONSTRATION PROGRAMS
C.3 GPIB User Interface Program
GPCOM.BAS is a user interface program which illustrates the principles of the use of the serial poll
status byte to coordinate the command and data transfer.
The program runs under Microsoft GW-BASIC or QuickBASIC on a PC-compatible computer fitted
with a National Instruments IEEE-488 interface card and the GPIB.COM software installed in the
CONFIG.SYS file. The program BIB.M, and the first three lines of GPCOM, are supplied by the card
manufacturer and must be the correct version for the particular version of the interface card in use.
The interface card may be set up, using the program IBCONF.EXE, to set EOI with the last byte of
Write in which case no terminator is required. (Read operations are automatically terminated on EOI
which is always sent by the lock-in). Normally, the options called ‘high-speed timing’, ‘interrupt jumper
setting’, and ‘DMA channel’ should all be disabled.
The principles of using the Serial Poll Status Byte to control data transfer, as implemented in the
main loop of GPCOM, are recommended for incorporation in the user’s own programs.
10 'GPCOM 9-Feb-96
20 '....the following three lines and BIB.M are supplied by the.......
30 '....manufacturer of the GPIB card, must be correct version........
40 CLEAR,60000!:IBINIT1=60000!:IBINIT2=IBINIT1+3:BLOAD"BIB.M",IBINIT1
50 CALL
IBINIT1(IBFIND,IBTRG,IBCLR,IBPCT,IBSIC,IBLOC,IBPPC,IBBNA,IBONL,IBRSC,IBSRE,IBRSV,IBPAD,
IBSAD,IBIST,IBDMA,IBEOS,IBTMO,IBEOT,IBRDF,IBWRTF,IBTRAP)
60 CALL
IBINIT2(IBGTS,IBCAC,IBWAIT,IBPOKE,IBWRT,IBWRTA,IBCMD,IBCMDA,IBRD,IBRDA,IBSTOP,
IBRPP,IBRSP,IBDIAG,IBXTRC,IBRDI,IBWRTI,IBRDIA,IBWRTIA,IBSTA%,IBERR%,IBCNT%)
70 '.................................................
80 CLS: PRINT"DEVICE MUST BE SET TO CR TERMINATOR"
90 '....assign access code to interface board........
100 BDNAME$="GPIB0"
110 CALL IBFIND(BDNAME$,GPIB0%)
120 IF GPIB0%<0 THEN PRINT "board assignment error":END
130 '....send INTERFACE CLEAR.........................
140 CALL IBSIC(GPIB0%)
150 '....set bus address, assign access code to device..........
160 SUCCESS% = 0
170 WHILE SUCCESS% = 0
180 INPUT "BUS ADDRESS ";A%
190 DEVNAME$ = "DEV"+RIGHT$(STR$(A%),LEN(STR$(A%))-1)
200 CALL IBFIND(DEVNAME$,DEV%) ' assign access code
210 IF DEV%<0 THEN PRINT "device assignment error": END
220 A$ = CHR$(13): GOSUB 480 ' test: write <CR> to bus
230 IF IBSTA%>0 THEN SUCCESS% = 1
240 IF (IBSTA%<0 AND IBERR%=2) THEN BEEP: PRINT "NO DEVICE AT THAT ADDRESS"
250 WEND
260 '....send SELECTED DEVICE CLEAR...................
270 CALL IBCLR(DEV%)
280 '....set timeout to 1 second......................