beautypg.com

National Instruments GPIB-PC User Manual

Page 175

background image

BASICA/QuickBASIC GPIB-PC Function Calls

Section Four A

GPIB-PC User Manual

4A-100

©National Instruments Corp.

Board Example:

1.

Write 10 instruction bytes from the integer array

WRT%

to a

device at listen address &H2F (ASCII /) and then unaddress it
(the GPIB-PC talk address is &H40 or ASCII @).

100 REM Perform addressing.
110 CMD$ = "?@/"

' UNL MTA LAD

120 CALL IBCMD (BRD0%,CMD$)
130 REM Perform board write.
140 DIM WRT%(4)
150 WRT%(0) = ASC("F") + ASC("3") * 256
160 WRT%(1) = ASC("R") + ASC("1") * 256
170 WRT%(2) = ASC("X") + ASC("5") * 256
180 WRT%(3) = ASC("P") + ASC("2") * 256
190 WRT%(4) = ASC("G") + ASC("0") * 256
200 CNT% = 10
210 CALL IBWRTIA (BRD0%,WRT%(0),CNT%)
220 REM Perform other processing here then
230 REM wait for I/O completion or timeout.
240 MASK% = &H4100

' TIMO CMPL250

260 CALL IBWAIT (BRD0%,MASK%)
270 REM Unaddress the Talker and Listener.
280 CMD$ = "_?"

' UNT UNL

290 CALL IBCMD (BRD0%,CMD$)

For QuickBASIC Version 2.0 and 3.0,
replace line 210 with
:

CALL IBWRTIA (PTR%,VARPTR(WRT%(0)),CNT%)

For QuickBASIC Version 4.0,
replace line 210 with
:

CALL IBWRTIA (BD%,WRT%(),CNT%)