Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
©National Instruments Corp. 4A-103 GPIB-PC User Manual
BASICA Example Program - Device
BASICA - Using device function calls.
100 REM You must merge this code with DECL.BAS.
105 REM
110 REM Assign a unique identifier to device and
120 REM store in variable DVM%.
125 REM
130 BDNAME$ = "DVM"
140 CALL IBFIND (BDNAME$,DVM%)
145 REM
150 REM Check for error on IBFIND call.
155 REM
160 IF DVM% < 0 THEN GOTO 2000
170 REM
180 REM Clear the device.
185 REM
190 CALL IBCLR (DVM%)
195 REM
200 REM Check for an error on each GPIB call to
210 REM be safe.
215 REM
220 IF IBSTA% < 0 THEN GOTO 3000
230 REM
240 REM Write the function, range, and trigger
250 REM source instructions to the DVM.
255 REM
260 WRT$ = "F3R7T3" : CALL IBWRT (DVM%,WRT$)
270 IF IBSTA% < 0 THEN GOTO 3000
280 REM
290 REM Trigger the device.
295 REM
300 CALL IBTRG (DVM%)
310 IF IBSTA% < 0 THEN GOTO 3000
320 REM
330 REM Wait for the DVM to set RQS or for a
340 REM timeout; if the current time limit is too
350 REM short, use IBTMO to change it.
355 REM
360 MASK% = &H4800 : CALL IBWAIT (DVM%,MASK%)
370 IF (IBSTA% AND &HC000) <> 0 THEN GOTO 3000
380 REM
390 REM Since neither a timeout nor an error
400 REM occurred, IBWAIT must have returned on
410 REM RQS. Next, serial poll the device.