CALL IBWRT(id%, Query$) ' Query the level
CALL IBRD(id%, buf$) ' Read in the response.
GPIBQuery$ = LEFT$(buf$, ibcnt% - 1) ' Remove trailing characters.
END FUNCTION
6.3.4 Example 4
DECLARE FUNCTION GPIBQuery$ (id%, Query$)
' **************************************************************
'
' Program 4 : Multi-step mode Version 1.0
'
' Platform : QuickBasic 4.5
'
' Description :
'
' This program sets up and runs a simple 4 frequency measurement
' in Multi-step mode
'
' **************************************************************
' $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.
' Go to multi-step mode
CALL IBWRT(wk%, ":MULTI") ' Multi-frequency mode
CALL IBWRT(wk%, ":MULTI:SET") ' Multi-frequency set-up
' Set-up steps
CALL IBWRT(wk%, ":MULTI:TEST 1; FUNC LS; FREQ 1k, LEV 1") ' Step 1
CALL IBWRT(wk%, ":MULTI:TEST 2; FUNC RS; FREQ 1k, LEV 1") ' Step 2
CALL IBWRT(wk%, ":MULTI:TEST 3; FUNC Q; FREQ 1k, LEV 1") ' Step 3
CALL IBWRT(wk%, ":MULTI:TEST 4; FUNC DCR") ' Step 4
CALL IBWRT(wk%, ":MULTI:TRIG")
PRINT GPIBQuery(wk%, ":MULTI:RES?") ' Get result
END ' The end!
' This function sends the supplied query to the instrument
' and reads back the reply and strips the trailing characters
FUNCTION GPIBQuery$ (id%, Query$)
buf$ = SPACE$(80) ' Initialise the buffer.
CALL IBWRT(id%, Query$) ' Query the level
CALL IBRD(id%, buf$) ' Read in the response.
GPIBQuery$ = LEFT$(buf$, ibcnt% - 1) ' Remove trailing characters.
END FUNCTION