![background image](http://html.mh-extra.com/html/national-instruments/gpib-device-simulator-eprom/gpib-device-simulator-eprom_programming-manual_710200020.webp)
© National Instruments Corp.
17
GPIB Device Simulator EPROM
Example 3
REM The following example shows how to set up the
Simulator
REM to assert an SRQ after it generates a sine waveform,
REM read the waveform and plot it on a graph.
DIM buffer AS STRING * 2000
DIM waveform#(128)
CALL ibfind ("DEV1", simulator%)
CALL ibfind ("GPIB0", board%)
CALL ibconfig (board%, 7, 0) 'Disable auto serial
polling
CALL ibpad (simulator%, 2) 'Simulator at address 2
CALL ibwrt (simulator%, "*ESE 0x01; *SRE 0x20;
SOUR:FUNC SIN; *OPC;")
CALL ibwait (board%, &H5000) 'Wait for SRQ
CALL ibrsp (simulator%, spbyte%) 'Get serial poll byte
CALL ibwrt (simulator%, "*ESR?;") 'Read ESR
CALL ibrd (simulator%, buffer$)
CALL ibwrt (simulator%, "SENS:DATA?") 'Query the
waveform
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)