Lakeshore Learning Materials 647 User Manual

Page 70

Advertising
background image

Lake Shore Model 647 Magnet Power Supply User’s Manual

Mainframe Remote Operation

B-4

B7.0 CONTROL BUS SERIAL INTERFACE SAMPLE PROGRAM
The following PC program is an interactive program that prompts the user for a Mainframe command and

displays the Mainframe response. The command must include a query for the Mainframe to respond.


'This QuickBasic 4.0 program is for an IBM PC or compatible. Enter the
'Mainframe command at the prompt. The Mainframe response then displays.
'"END" exits the program.

COUNT = 1000
TERM$ = CHR$(13) + CHR(10)

OPEN "com1:9600,o,7,1,RS" FOR RANDOM AS #1 LEN = 256

L1: INPUT "ENTER COMMAND (END TO EXIT):", CMD$

CMD$ = UCASE$(CMD$)
IF CMD$ = "END" THEN CLOSE #1: END
PRINT #1, CMD$ + TERM$

IF INSTR(CMD$, "W") <> 0 OR INSTR(CMD$, "XD") <> 0 OR INSTR(CMD$, "?") <> 0 THEN

RS$ = ""
N = 0
WHILE (N < COUNT) AND ((INSTR(RS$, TERM$) = 0) OR (RS$ = "")
R$ = INPUT$(LOC(1), #1)
IF R$ = "" THEN N = N + 1 ELSE N = 0
RS$ = RS$ + R$
WEND
IF RS$ <> "" THEN
RS$ = MID$(RS$, 1, (INSTR(RS$, TERM$) - 1))
PRINT "RESPONSE:"; RS$
ELSE
PRINT "NO RESPONSE"
END IF
END IF
GOTO L1

END

Advertising