National Instruments GPIB-PC User Manual

Page 179

Advertising
background image

BASICA/QuickBASIC GPIB-PC Function Calls

Section Four A

GPIB-PC User Manual

4A-104

©National Instruments Corp.

415 REM
420 CALL IBRSP (DVM%,SPR%)
430 IF IBSTA% < 0 THEN GOTO 3000
440 REM
450 REM Now test the status byte (SPR%).
460 REM If SPR% is &HC0, the DVM has valid data
470 REM to send; otherwise, it has a fault
475 REM condition to report.
480 REM
490 IF SPR% <> &HC0 THEN GOTO 4000
500 REM
510 REM If the data is valid, read the
520 REM measurement.
525 REM
530 RD$ = SPACE$(16) : CALL IBRD (DVM%,RD$)
540 IF IBSTA% < 0 THEN GOTO 3000
550 REM
560 REM To close out a programming sequence,
570 REM reset the device, and call IBONL to take
575 REM the device offline.
580 REM
585 CALL IBCLR (DVM%)
590 V% = 0 : CALL IBONL (DVM%,V%) : STOP

2000 REM A routine at this location would
2010 REM notify you that the IBFIND call
2020 REM failed, and refer you to the handler
2030 REM software configuration procedures.
2040 PRINT "IBFIND ERROR" : STOP

3000 REM An error checking routine at this
3010 REM location would among other things,
3020 REM check IBERR to determine the exact
3030 REM cause of the error condition and then
3040 REM take action appropriate to the
3050 REM application. For errors during data
3060 REM transfers, IBCNT may be examined to
3070 REM determine the actual number of bytes
3080 REM transferred.
3090 PRINT "GPIB ERROR" : STOP

4000 REM A routine at this location would
4010 REM analyze the fault code returned in the
4020 REM DVM's status byte and take appropriate
4030 REM action.
4040 PRINT "DVM ERROR" : STOP
5000 END

Advertising