40
Example 2
IBM PC, IBM BASIC Using the National Instruments GPIB Interface.
Refer to the previous example for a discussion about the National Instruments GPIB interface.
This BASIC program does exactly the same thing as the C program in the previous example. Be sure
to use the file DECL.BAS provided by National Instruments to start the program. DECL.BAS
contains the initialization procedures for the GPIB driver.
10 ' EXAMPLE PROGRAM USING MICROSOFT BASIC AND THE NATIONAL INSTRUMENTS GPIB CARD
30 ' THIS PROGRAM ASSUMES THAT THE FS700 IS INSTALLED AS DEVICE LORAN USING IBCONF
40 '
50 ' USE THE FILE DECL.BAS PROVIDED BY NATIONAL INSTRUMENTS TO INITIALIZE THE GPIB
DRIVER
60 '
100 CLEAR ,60000! : IBINIT1=60000! : IBINIT2=3 : BLOAD "bib.m",IBINIT1
110 CALL IBINIT1(IBFIND, IBTRG, IBCLR, IBPCT, IBSIC, IBLOC, IBPPC, IBBNA, IBONL, IBRSC, IBSRE,
IBRSV, IBPAD, IBSAD, IBIST, IBDMA, IBEOS, IBTMO, IBEOT, IBRDF, IBWRTF, IBTRAP)
120 CALL IBINIT2(IBGTS, IBCAC, IBWAIT, IBPOKE, IBWRT, IBWRTA, IBCMD, IBCMDA, IBRD, IBRDA,
IBSTOP, IBRPP, IBRSP, IBDIAG, IBXTRC, IBRDI, IBWRTI, IBRDIA, IBWRTIA, IBSTA%, IBERR%, IBCNT%)
130 '
140 ' DONE WITH DECL.BAS
150 '
160 ' OUR PROGRAM STARTS HERE
170 BDNAME$="LORAN"
180 CALL IBFIND(BDNAME$, FS700%) ' FIND FS700
190 IF FS700% < 0 GOTO 1000
200 '
210 WRT$="GRIP 99400"
' SET WEST COAST USA GRI
220 CALL IBWRT(FS700%, WRT$)
230 '
240 WRT$="AUTO 0"
'SET TO MANUAL SEARCH
250 CALL IBWRT(FS700%, WRT$)
260 '
270 WRT$="STRT"
' START SEARCH
280 CALL IBWRT(FS700%, WRT$)
290 '
300 WRT$="GRIP?
' QUERY GRI
320 CALL IBWRT(FS700%, WRT$)
330 '
350 S$=SPACE$(20)
'PRINT GRI RESPONSE
360 CALL IBRD(FS700%, S$)
370 PRINT "GRI =";S$
380 '
390 STOP
1000 PRINT "CANNOT FIND DEVICE LORAN"
1010 STOP