
CALL ibclr(dvm%)
IF (ibsta% AND EERR) THEN CALL gpiberr("Ibclr Error")
' Reset the meter by issuing the reset (*RST) command and delay 4 second. Instruct the
' meter to measure the volts direct current (VDC) using auto-ranging (AUTO).
' If the error bit EERR is set in IBSTA%, call GPIBERR with an error message.
wrt$ = "*RST"
CALL ibwrt(dvm%, wrt$)
IF (ibsta% AND EERR) THEN CALL gpiberr("Ibwrt Error")
SLEEP 4
wrt$ = "CONF:VOLT:DC"
CALL ibwrt(dvm%, wrt$)
IF (ibsta% AND EERR) THEN CALL gpiberr("Ibwrt Error")
' Initialize the accumulator of the 10 measurements to zero.
sum = 0!
' Establish FOR loop to read the 10 measurements. The variable i% will
' serve as a counter for the FOR loop.
FOR i% = 1 TO 10
' Request the measurement by sending the instruction
' "READ?". If the error bit EERR is set in IBSTA%, call GPIBERR
' with an error message.
wrt$ = "READ?"
CALL ibwrt(dvm%, wrt$)
IF (ibsta% AND EERR) THEN CALL gpiberr("Ibwrt Error")
' Read the meter measurement. If the error bit EERR is set in
' IBSTA%, call GPIBERR with an error message.
rd$ = SPACE$(11)
CALL ibrd(dvm%, rd$)
IF (ibsta% AND EERR) THEN CALL gpiberr("Ibrd Error")
' Remove blank spaces in RD$ and assign resulting buffer to READING$.
' Print measurement returned by the meter.
reading$ = LEFT$(rd$, ibcnt%)
PRINT "reading: "; reading$
' Convert READING$ to its numeric value and add to the accumulator.
sum = sum + VAL(reading$)
NEXT i% ' Continue FOR loop until 10 measurements are read.
' Print the average of the 10 readings.
PRINT "The average of the 10 readings is: ", sum / 10
' Call the IBONL function to disable the hardware and software.
90