User Curve Loading Program - Lakeshore 330 User Manual

Autotuning temperature controller
Table of Contents

Advertisement

Lake Shore Model 330 Autotuning Temperature Controller User's Manual
4.4

USER CURVE LOADING PROGRAM

To simplify the loading of a user curve using the Serial Interface, the following curve loading program is
provided. The program will work with QuickBASIC V4.0/4.5 or QBasic for use on an IBM PC or compatible
with serial interface. The user should create an ASCII file with the curve data in the same format as used in
the CURV command. Immediately following the program are two sample user curve files. Then launch the
Curve Loading Program where you will be prompted for a file name. The program will then open the ASCII file
and download the data. (The line of code in bold is the only difference between the first part of this program
and the example shown below.
'
SERCURV.BAS
'
This program works with QuickBasic 4.0/4.5 or QBasic on an IBM PC or compatible
'
with a serial interface. It uses the COM1 communication port and 300 BAUD.
'
'
To use, enter an instrument command or query at the prompt. The command goes to
'
the instrument and any query response displays. "EXIT" exits the program.
'
NOTE: The INPUT instruction in this example accepts no commas as part of an input
'
string. If a comma appears in an instrument command, replace it with a space
'
when entering data from the keyboard.
'
CLS
PRINT " SERIAL COMMUNICATION PROGRAM"
PRINT
TIMEOUT = 2000
BAUD$ = "300"
TERM$ = CHR$(13) + CHR$(10)
OPEN "COM1:" + BAUD$ + ",o,7,1,RS" FOR RANDOM AS #1 LEN = 256
LOOP1: INPUT "ENTER COMMAND (or EXIT):"; CMD$
CMD$ = UCASE$(CMD$)
IF CMD$ = "EXIT" THEN CLOSE #1: END
IF CMD$ = "CURVE" THEN GOTO LOAD
CMD$ = CMD$ + TERM$
PRINT #1, CMD$;
IF INSTR(CMD$, "?") <> 0 THEN
RS$ = ""
N = 0
WHILE (N < TIMEOUT) AND (INSTR(RS$, TERM$) = 0) 'Wait for response
IN$ = INPUT$(LOC(1), #1)
IF IN$ = "" THEN N = N + 1 ELSE N = 0 'Add 1 to timeout if no chr
RS$ = RS$ + IN$
WEND
IF RS$ <> "" THEN
RS$ = MID$(RS$, 1, (INSTR(RS$, TERM$) - 1)) 'Strip off terminators
PRINT "RESPONSE:"; RS$
ELSE
PRINT "NO RESPONSE"
END IF
END IF
GOTO LOOP1
Remote Operation
EXAMPLE PROGRAM FOR SERIAL INTERFACE
'Clear screen
'Read timeout (may need more)
'BAUD rate 300 (or 1200)
'Terminators are <CR><LF>
'Get command from keyboard
'Change input to upper case
'Get out on Exit
'Load a curve from disk file
'Send command to instrument
'Test for query
'If query, read response
'Clr return string and count
'Get one character at a time
'Add next chr to string
'Get chrs until terminators
'See if return string is empty
'Print response to query
'No response to query
'Get next command
4-23

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents