7-6 Remote Program Examples using GPIB interface
Example Using Quick BASIC
'
GPIBEXAMPLE.BAS
'
' This sample program is for reference only. It can only be expected to
' function with a Digital Multimeter.
'
' This program reads 10 measurements from the meter and averages
' the sum.
'
' The status variables IBSTA%, IBERR%, and IBCNT% are defined in QBDECL.BAS.
' Each bit of IBSTA% and each value of IBERR% are defined in QBDECL.BAS as
' a mnemonic constant for easy recognition in application programs. In this
' example, these mnemonic definitions are logically ANDed with the variable
' IBSTA% to determine if a particular bit has been set. The mnemonic
' definitions are equated with the variable IBERR% to determine the error
' code.
'
' The subroutine GPIBERR is called when a NI-488 function fails. The
' error message is printed along with the status variables IBSTA%, IBERR%,
' and IBCNT%. The subroutine DVMERR is called when the serial poll response
' byte indicates the meter does not have valid data to send. The error
' message and the serial poll response byte are printed.
'
' The NI-488 function IBONL is called from the main body of the program or
' from the two subroutines, GPIBERR and DVMERR. When the second parameter
' of the function IBONL is zero, the software and hardware are disabled.
' Execution of this program is terminated after the call to the function
' IBONL to disable the software and hardware.
'
' The STOP command or END command will terminate this program.
'=========================================================================
' QBDECL.BAS contains constants, declarations, and subroutine prototypes.
REM $INCLUDE: 'qbdecl.bas'
' GPIBERR is an error subroutine that is called when a NI-488 function fails.
' DVMERR is an error subroutine that is called when the meter does not
' have valid data to send.
DECLARE SUB gpiberr (msg$)
DECLARE SUB dvmerr (msg$, spr%)
CLS
PRINT "Read 10 measurements from the meter..."
PRINT
' Assign a unique identifier to the meter and store in the variable
' DVM. IBDEV opens an available device and assigns it to access GPIB0
' with a primary address of 8, a secondary address of 0, a timeout of
' 30 seconds, the END message enabled, and the EOS mode disabled.
' If DVM is less than zero, call GPIBERR with an error message.
CALL ibdev(0, 8, 0, T30s, 1, 0, dvm%)
IF (dvm% < 0) THEN CALL gpiberr("Ibdev Error")
' Clear the internal or device functions of the meter. If the error bit
' EERR is set in IBSTA%, call GPIBERR with an error message.
89
Содержание 3136A
Страница 1: ...E E ES S SC C CO O OR R RT T T...
Страница 2: ...50000 COUNT DUAL DISPLAY MULTIMETER O Op pe er ra at ti io on na al l M Ma an nu ua al l...
Страница 44: ...40 This page is subject to be blank...
Страница 74: ...70...
Страница 107: ...P N 91 25195 1A Printed in Taiwan...