© National Instruments Corp.
15
GPIB Device Simulator EPROM
LabWindows Examples
Example 1
REM The following example shows how to set up the
Simulator
REM to generate a square waveform, read the waveform, and
REM plot it on a graph.
DIM buffer AS STRING * 2000
DIM waveform#(128)
CALL ibfind ("DEV1", simulator%)
CALL ibpad (simulator%, 2) 'Simulator at address 2
CALL ibwrt (simulator%, "SOUR:FUNC SQU; SENS:DATA?")
CALL ibrd (simulator%, buffer$)
REM Discard header and convert ASCII data to
REM floating-point array
n% = Scan (buffer$, "%s[i6]>%128f[x]", waveform#())
uir.err% = YGraphPopup (waveform#(), 128, 4)
Example 2
REM The following example shows how to set up the
Simulator
REM to generate a noisy sine waveform, read the waveform,
REM and plot it on a graph. The waveform is transferred
in
REM 2-byte binary.
DIM buffer AS STRING * 2000
DIM waveform%(128)
CALL ibfind ("DEV1", simulator%)
CALL ibfind ("GPIB0", board%)
CALL ibpad (simulator%, 2) 'Simulator at address 2
CALL ibwrt (simulator%, "FORM:DATA INT,16;
SOUR:FUNC NOIS;SENS:DATA?")
CALL ibrd (simulator%, buffer$)