Appendix C, Demonstration Programs; C1 Simple Terminal Emulator; C2 Rs232 Control Program With Handshakes - Ametek 7280 Instruction Manual

Wide bandwidth 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 GWBASIC 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 GWBASIC 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, 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
100
B$ = B$ + CR$
110
GOSUB 180
120
GOSUB 310: PRINT Z$;
' carriage return
' infinite loop
' no commas are allowed in B$
' append a carriage return
' output the command B$
' read and display response
C
Appendix
C-1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents