112
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 IEEEout$ out to the IEEE port.
Write.IEEE.String:
IEEEout$ = IEEEout$ + CHR$(10) ‘Append a <LF> to IEEEout$
CALL IBWRT(device.number%, IEEEout$) ‘Write IEEEout$ to IEEE-488 port
RETURN
‘Read.IEEE.String: Read a string from the 2835-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 IEEEin$
Read.IEEE.String:
timeout.error% = 0
‘Initiate to no timeout error
poll% = 0
IEEEin$ = SPACE$(255) ‘Initiate IEEEin$ 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% = 1) THEN
PRINT “IEEE-488 port timed out when trying to read input.”
ELSE
CALL IBRD(device.number%, IEEEin$) ‘Read IEEE-488 port
IEEEin$ = RTRIM$(IEEEin$) ‘Trim trailing spaces
PRINT IEEEin$; ‘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