Comm.bas - A Simple Basic Comms Program - Brainboxes RS422 Manual

Hide thumbs Also See for RS422:
Table of Contents

Advertisement

Serial Utilities and Programming
even if it passes COMTEST since this program does not check the
line drivers or external connection of the card.

COMM.BAS - A Simple BASIC Comms Program.

Figure 5-1 is the most simple two way communications
program possible in BASIC. This source code is included on the
disk as COMM.BAS, the program COMM.EXE is the compiled
ready to run version.
Figure 5-1. COMM.BAS Simple BASIC Program.
10 A$ = "COM2:2400,N,8,1,CS0,DS0,CD0,RS"
20 CLS : PRINT "COMMS PARAMS ARE "; A$
30 OPEN A$ FOR RANDOM AS #1
40 OPEN "CON" FOR OUTPUT AS #2
80 :
100 B$ = INKEY$:
110 IF B$ = "" THEN 130: REM IF NO DATA THEN SKIP
130 PRINT #2, B$;
160 IF B$ = CHR$(27) THEN END :REM EXIT IF USER
170 PRINT #1, B$;
180
190 IF EOF(1) THEN 100: REM IF ANY DATA TO READ
200 A$ = INPUT$(LOC(1), #1)
210 PRINT #2, A$;
220 :
300 GOTO 100
Note:
Basic, GW-BASIC, Quick Basic and MS DOS version 5
QBasic all expect:-
COM1: to be address 03f8hex using interrupt IRQ4
COM2: to be address 02f8hex using interrupt IRQ3.
Line 10
The serial port parameters are set to COM2, 2400
baud, No parity, 8 data bits 1 stop bit, ignore
Chapter 5 Page 58
AT & OPTO DUAL RS422/485
REM CHANGE TO SUIT YOUR SETUP!
PRESSED ESCAPE
THEN GET IT

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rs485

Table of Contents