57
CLS
LOCATE 1, 22: PRINT “N E W P O R T C O R P O R A T I O N”
LOCATE 2, 19: PRINT “1830-C to IEEE-488 Communication Program”
PRINT : PRINT
RETURN
‘Enter.User.Commands: Get and interpret the user’s commands.
Enter.User.Commands:
DO ‘Get and process user input until Q, or QUIT input.
IEEEout$ = “” ‘Clear IEEEout$ string
LINE INPUT IEEEout$ ‘Get the user input
IEEEout$ = UCASE$(IEEEout$) ‘Convert input to upper case
SELECT CASE IEEEout$
CASE “Q”, “QUIT” ‘Exit on Q
RETURN
CASE “IBCLR” ‘Allow user to issue device clear
CALL IBCLR(device.number%) ‘Send a device clear
‘(National Instruments command)
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 deliminating <LF> to IEEEout$
CALL IBWRT(device.number%, IEEEout$) ‘Write IEEEouit$ to IEEE-488 port
‘(National Instruments command)
RETURN
‘Read.IEEE.String: Read a string from the 1830-C IEEE port. The string
‘ read from the IEEE-488 port is printed on the screen.
Read.IEEE.String:
timeout.error% = 0 ‘Initiate to no timeout error
ON TIMER(3) GOSUB timeout
IEEEin$ = SPACE$(255) ‘Initiate IEEEin$ to 255 spaces
poll% = 0
‘wait for MAV bit to be set
TIMER ON
WHILE ((timeout.error% = 0) AND ((poll% AND &H10) = 0))
CALL IBRSP(device.number%, poll%)
WEND
TIMER OFF ‘Turn timer off
IF (timeout.error% = 1) THEN