Appendix C, Demonstration Programs; Simple Terminal Emulator; Rs232 Control Program With Handshakes - IBM 7220 Instruction Manual

Dsp lock-in amplifier
Table of Contents

Advertisement

Demonstration
Programs
C.1 Simple Terminal Emulator
This is a short terminal emulator with minimal facilities, which will run on a PC-compatible computer
in a Microsoft GW-BASIC or QuickBASIC environment, or can be compiled with a suitable compiler.
10 'MINITERM 9-Feb-96
20 CLS: PRINT "Lockin RS232 parameters must be set to 9600 baud, 7 data bits, 1 stop bit and
even parity"
30 PRINT "Hit <ESC> key to exit"
40 OPEN "COM1:9600,E,7,1,CS,DS" FOR RANDOM AS #1
50 '..............................
60 ON ERROR GOTO 180
70 '..............................
100 WHILE (1)
110
B$ = INKEY$
120
IF B$=CHR$(27) THEN CLOSE #1: ON ERROR GOTO 0: END
130
IF B$<>"" THEN PRINT#1, B$;
140
LL% = LOC(1)
150
IF LL%>0 THEN A$ = INPUT$(LL%,#1): PRINT A$;
160 WEND
170 '..............................
180 PRINT "ERROR NO.";ERR: RESUME
C.2 RS232 Control Program with Handshakes
RSCOM2.BAS is a user interface program which illustrates the principles of the echo handshake.
The program will run on a PC-compatible computer either in a Microsoft GW-BASIC or QuickBASIC
environment, or in compiled form.
The subroutines in RSCOM2 are recommended for incorporation in the user's own programs.
10 'RSCOM2 9-Feb-96
20 CLS: PRINT "Lockin RS232 parameters must be set to 9600 baud, 7 data bits, 1 stop bit and
even parity"
30 OPEN "COM1:9600,E,7,1,CS,DS" FOR RANDOM AS #1
40 CR$=CHR$(13)
50 '
60 '...main loop..................
70 WHILE 1
80
INPUT "command (00 to exit) ";B$
90
IF B$="00" THEN END
Appendix
' carriage return
' infinite loop
' no commas are allowed in B$
C
C-1

Advertisement

Table of Contents
loading

Table of Contents