Radio Shack TRS-80 Model 100 Basic Manual page 180

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

List the program to confirm that it is:
10 OPEN ICOM:3701D" FOR INPUT AS 1
20 ON COM GOSUB 100
30 COM ON
a0
PRINT I : 1=1+1
GOTO
a0
100 N$
=
INPUT$ (1 11) : PRINT N$;
110 IF N$<>CHR$(13) GO TO 100
120 PRINT : RETURN
Execute this program and have the peripheral device send a long string of characters
terminated with a carriage return. You should see the string correctly displayed on the
Model 100.
The program has been modified to keep inputting characters from the serial port while
still in the interrupt subroutine. The interrupt subroutine will be
t~rminated
in line 120
if a carriage return (ASCII value 13) is detected in line 110. The PRINT statement in
line 120 is necessary to print a line feed before returning to the main program.
A word of caution: Since the receiving program is written in BASIC, and the serial
port buffer has a limited capacity, you still cannot receive long flIes without missing
some characters. This is especially true at higher baud rates.
The procedure described above should therefore be used only with applications
requiring relatively short strings to
be
transmitted at anyone time. It is also
recommended that you keep the baud rate at 300 or below, if possible.
What you have learned:
In this lesson you were shown how to use the serial port to communicate with other
serial devices. This allows transferring BASIC programs and data files between
computers and sending and receiving data between various peripheral devices.
174

Advertisement

Table of Contents
loading

Table of Contents