6 examples of rs232 programs, 1 program without checksum – INFICON XTC/C Thin Film Deposition Controller User Manual
Page 98
3 - 34
IP
N 07
4-
18
3X
XTC/C - XTC/2 Operating Manual
3.8.6 Examples of RS232 Programs
3.8.6.1 Program Without Checksum
10 ’----XTC/2 RS232 COMMUNICATIONS PROGRAM WITHOUT CHECKSUM----
20 ’
30 ’------THIS PROGRAM IS DESIGNED TO TRANSMIT INDIVIDUAL COMMANDS TO THE XTC/2
AND ACCEPT THE APPROPRIATE RESPONSE FROM THE XTC/2, WRITTEN IN GWBASIC 2.32.
40 ’
50 OPEN "COM1:9600,N,8,1,CS,DS" AS #1
:’--OPEN COMM PORT 1
60 NAK$ = CHR$(21): ACK$ = CHR$(6)
:’--DEFINE ASCII CODES
70 ’
80 INPUT "ENTER COMMAND"; CMD$
:’--ENTER COMMAND TO XTC/2
90 GOSUB 130
:’--GOTO TRANSMIT COMMAND
SUBROUTINE.
100 PRINT RESPONSE$
:’--PRINT XTC/2 RESPONSE
110 GOTO 80
:’--LOOP BACK FOR ANOTHER
COMMAND.
120 ’
130 ’----TRANSMIT COMMAND AND RECEIVE RESPONSE SUBROUTINE----
140 ’
150 ’----SEND COMMAND MESSAGE STREAM TO THE XTC/2----
160 PRINT #1, CMD$ + ACK$;
170 ’
180 ’----RECEIVE RESPONSE MESSAAGE FROM THE XTC/2----
190 RESPONSE$ = ""
:’--NULL THE RESPONSE
200 TOUT = 3: GOSUB 260
:’ STRING AND SET TIMER.
210 IF I$ = ACK$ THEN RETURN
:’--IF THE END OF RESPONSE
220 IF I$ = NAK$ THEN RETURN
:’ CHARACTER IS RECEIVED
GOTO PRINT RESPONSE.
230 RESPONSE$ = RESPONSE$ + I$
:’--BUILD RESPONSE STRING
240 GOTO 200
:’ CHARACTER BY CHARACTER.
250 ’
260 ’----READ SERIALLY EACH CHARACTER FROM THE INSTRUMENT INTO VARIABLE I$----
270 ON TIMER (TOUT) GOSUB 300: TIMER ON
280 IF LOC(1) < 1 THEN 280 ELSE TIMER OFF: I$ = INPUT$(1,#1)
290 RETURN
300 TIMER OFF
:’--INDICATE IF A CHARACTER
310 RESPONSE$ = "RECEIVE TIMEOUT"
:’ IS NOT RECEIVED WITHIN
320 I$ = NAK$: RETURN 290
:’ 3 SECS.