Radio Shack TRS-80 Model 100 Basic Manual page 179

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

Advertisement

Line 19 The OPEN statement defines the serial port for input as file number 1 at 300
baud, 7 data bits, odd parity, 1 stop bit and
XON/XOFF
disabled.
Note: This configuration should parallel that of the peripheral device. Change the
configuration if
it
is not the same.
Line 29 An interrupt subroutine beginning at line number 100 will be executed if a
character is received through the serial port.
Line 39 The serial port interrupt l:apability is turned on. You can prevent the serial
port from interrupting the program with the
COM OFF
statement. Similarly, if you wish to delay interrupts, you can use the
COM STOP
statement which defers the interrupt until a COM ON statement is executed.
Line 49 This loop prints numbers starting at zero and incrementing by one each time.
Since it is an infinite loop, you must press
~
to terminate the program.
Line 199 When a character is received through the serial port, an interrupt is
generated and execution jumps to this line. No interrupts can occur during an interrupt
subroutine. If a character is received during the interrupt subroutine, it will be
remembered, and another interrupt will occur when the current one is completed.
This line will display the received character and then return to the main program. The
INPUT$
(l, l)
statement inputs one character from file number 1. In general, the
function
INPUT$ (n,t)
will return
n
characters from file number
f.
In the case of the COM: device, the
program will wait until all
n
characters are received before it returns.
Experiment #8 Multiple Character Interrupt
While the procedure in the previous experiment works well with short strings, it will
not work if the peripheral device sends strings longer than around
20.
characters at a
time. You can handle this situation by having the interrupt subroutine input all the
characters in the string before returning.
This experiment shows how to modify the program to accommodate longer strings
with interrupts. Change line
100
to
100 N$
=
INPUT$ (1 d) : PRINT N$;
and add two new lines
110 IF N$<>CHR$(13) GOTO 100
120 PRINT : RETURN
173

Advertisement

Table of Contents
loading

Table of Contents