beautypg.com

National Instruments GPIB-PC User Manual

Page 174

background image

Section Four A

BASICA/QuickBASIC GPIB-PC Function Calls

©National Instruments Corp.

4A-99

GPIB-PC User Manual

NOTE: Do not pass dynamic arrays to the asynchronous functions

IBRDIA

and

IBWRTIA

, since the QuickBASIC environment might

move them around in memory during an I/O operation.

Device Example:

1.

Write 10 instruction bytes from integer array to the device

DVM%

while performing other processing.

100 DIM WRT%(4)
110 WRT%(0) = ASC("F") + ASC("3") * 256
120 WRT%(1) = ASC("R") + ASC("1") * 256
130 WRT%(2) = ASC("X") + ASC("5") * 256
140 WRT%(3) = ASC("P") + ASC("2") * 256
150 WRT%(4) = ASC("G") + ASC("0") * 256
160 CNT% = 10
170 CALL IBWRTIA (DVM%,WRT%(0),CNT%)
180 MASK% = &H4100

' TIMO CMPL

190 REM Perform other processing here then
200 REM wait for I/O completion or timeout.
210 CALL IBWAIT (DVM%,MASK%)
220 REM Check IBSTA% to see how the write
230 REM terminated on: CMPL, END, TIMO, or
240 REM ERR.
250 REM If CMPL is not set, continue
260 REM processing.
270 IF (IBSTA% AND &H100) = 0 GOTO 190

QuickBASIC Version 2.0 and 3.0,
replace line 170 with:

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

QuickBASIC Version 4.0, replace line 170 with:

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