6.3.2 Example 2
' **************************************************************
'
' Program 2 : Simple Measurement Version 1.0
'
' Platform : QuickBasic 4.5
'
' Description :
'
' This program will set-up and run a single Z+Angle measurement
' on a component.
' This program assumes that the GPIB configuration is correct
' enough to be able to run example program 1 correctly.
'
' **************************************************************
' $INCLUDE: 'QBDECL.BAS' ' National Instruments include file.
CLS ' Clear the screen.
' Initialise the GPIB
CALL IBFIND("WK", wk%) ' Look for 'WK'.
CALL IBCLR(wk%) ' Clear the device.
' Select the required operating mode
CALL IBWRT(wk%, ":MEAS") ' Go to measurement mode.
CALL IBWRT(wk%, ":MEAS:TEST:AC")
CALL IBWRT(wk%, ":MEAS:FUNC:Z") ' Select Z+Angle.
' Set-up measurement conditions.
' Level = 100mV Freq = 10kHz
' Speed = Medium
' Range = AUTO
CALL IBWRT(wk%, ":MEAS:LEVEL 0.1; FREQ 1E4; SPEED MED")
CALL IBWRT(wk%, ":MEAS:RANGE AUTO")
' Perform the measurement.
buf$ = SPACE$(200) ' Prepare buffer for GPIB response.
CALL IBWRT(wk%, "TRIG") ' Trigger a measurement.
CALL IBRD(wk%, buf$) ' Read in the response.
buf$ = LEFT$(buf$, ibcnt% - 1) ' Remove trailing characters.
' The next piece of code extracts the numbers from
' the response so that they can be manipulated.
first = VAL(LEFT$(buf$, INSTR(buf$, ",") - 1))
second = VAL(RIGHT$(buf$, LEN(buf$) - INSTR(buf$, ",") - 1))
' Display the final result.
PRINT " Z = "; first
PRINT "Angle = "; second
END ' The end.
6.3.3 Example 3
DECLARE FUNCTION GPIBQuery$ (id%, Query$)
' **************************************************************
'