National Instruments GPIB-PC User Manual

Page 181

Advertising
background image

BASICA/QuickBASIC GPIB-PC Function Calls

Section Four A

GPIB-PC User Manual

4A-106

©National Instruments Corp.

430 REM
440 REM Send the GET message to trigger a
450 REM measurement reading.
455 REM
460 CMD$ = CHR$(&H8) : CALL IBCMD (BRD0%,CMD$)
470 IF IBSTA% < 0 THEN GOTO 3000
480 REM
490 REM Wait for the DVM to set SRQ or for a
500 REM timeout; if the current time limit is too
510 REM short, use IBTMO to change it.
515 REM
520 MASK% = &H5000
530 CALL IBWAIT (BRD0%, MASK%)
540 IF (IBSTA% AND &HC000) <> 0 THEN GOTO 3000
550 REM
560 REM Since neither a timeout nor an error
570 REM occurred, IBWAIT must have returned on
580 REM SRQ. Next do a serial poll. First
590 REM unaddress bus devices and send the Serial
600 REM Poll Enable (SPE) command, then send the
610 REM DVM's talk address and the GPIB-PC listen
615 REM address &H20 (ASCII space).
620 REM
630 CMD$ = "?_" + CHR$(&H18) + "C "
640 CALL IBCMD (BRD0%,CMD$)
650 IF IBSTA% < 0 THEN GOTO 3000
660 REM
670 REM Now read the status byte. If it is &HC0,
680 REM the DVM has valid data to send;
690 REM otherwise, it has a fault condition to
695 REM report.
700 REM
710 RD$ = SPACE$(1) : CALL IBRD (BRD0%,RD$)
720 IF IBSTA% < 0 THEN GOTO 3000
730 IF ASC(RD$) <> &HC0 THEN GOTO 4000
731 REM
732 REM If more than one device were attached to
734 REM the bus, it would be necessary to
735 REM explicitly check the &H40 bit of the DVM
736 REM status word to be sure that another
738 REM device had not been responsible
740 REM for asserting SRQ. Complete
750 REM the serial poll by sending the Serial
760 REM Poll Disable (SPD) message.
765 REM
770 CMD$ = CHR$(&H19) : CALL IBCMD (BRD0%,CMD$)
780 IF IBSTA% < 0 THEN GOTO 3000

Advertising