Demonstration
Programs
Appendix
C
C-1
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)
' carriage return
50 '
60 '...main loop..................
70 WHILE 1
' infinite loop
80
INPUT "command (00 to exit) ";B$
' no commas are allowed in B$
90
IF B$="00" THEN END
Содержание 7220
Страница 8: ...v i TABLE OF CONTENTS...
Страница 12: ...1 4 Chapter 1 INTRODUCTION...
Страница 76: ...5 36 Chapter 5 FRONT PANEL OPERATION...
Страница 124: ...D 2 Appendix D CABLE DIAGRAMS Figure D 2 Interconnecting RS232 Cable Wiring Diagram...
Страница 146: ...E 22 Appendix E ALPHABETICAL LISTING OF COMMANDS...
Страница 154: ...Index 6 INDEX...