CASE ELSE
GOSUB Write.IEEE.String 'Write user input to IEEE port
IF INSTR(IEEEout$,
"?")
<>
0 THEN 'If command was a query
GOSUB Read.IEEE.String
'
Read input data on IEEE port
END IF
END SELECT
LOOP WHILE 1
=
1
RETURN
'Write.IEEE.String: Write the string IEEEoutS out to the IEEE port.
Write.IEEE.String:
IEEEoutS
=
IEEEoutS
+
CHRS(10) 'Append a <LF> to IEEEoutS
CALL IBWRT(device.number%, IEEEoutS) 'Write IEEEoutS to IEEE-488 port
RETURN
'Read.IEEE.String: Read a string from the 2832-C IEEE port. The string
read from the IEEE-488 port is printed on the screen. If the
MAV
bit
in the status byte doesn't go high after 8 seconds then this routine
will timeout. Otherwise the query response is in IEEEinS
Read.IEEE.String:
timeout.error%
=
0 'Initiate to no timeout error
poll%
=
0
IEEEinS
=
SPACES(255) 'Initiate IEEEinS to 255 spaces
ON TIMER(8) GOSUB timeout
'wait for
MAV
bit in the status byte to be set or a timeout to occur
TIMER ON
WHILE
((poll% AND &H10)
=
0) AND (timeout.error%
=
0)
CALL IBRSP(device..number%, poll%)
WEND
TIMER OFF
IF (timeout.error%
=
I)
THEN
PRINT "IEEE-488 port timed out when trying to read input."
ELSE
CALL IBRD(device.number%, 1EEEinS) 'Read IEEE-488 port
IEEEinS
=
RTRIMS(1EEEinS) 'Trim trailing spaces
PRINT IEEEinS; 'Print the query response
END IF
RETURN
'timeout: Set timeout.error% flag. This routine is called if t seconds,
'as defined by the ON TIMER(t) function call, has elapsed between TIMER ON
'and TIMER OFF.
timeout
:
timeout.error%
=
1
RETURN
END 'End of Program Listing
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com