Radio Shack TRS-80 Model 100 Basic Manual page 177

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

Advertisement

6.
Load and execute a communications program on the other computer which will
transfer the desired ASCII file.
7.
To terminate the file transfer and mark the end of the file, press (f2) again.
8.
To exit the Terminal Mode, press
~
and then
CYJ
when the prompt
Disconnect?
appears on the screen. If you press CJ[), you will return to the Terminal Mode.
Experiment #5 Output to the COM:
device
You can use a BASIC program to communicate with peripheral devices through the
serial port. If you use the OPEN statement to define a COM: file, you can then direct
output to the serial port with a PRINT statement, or input data from the serial port
with an INPUT statement. This will be illustrated with examples in the following
experiments.
Suppose you want to input a name from the keyboard and then send it out the serial
port. From the Model 100 Menu, go to BASIC and enter the following program from
the keyboard:
10 OPEN "COM:3701D" FOR OUTPUT AS 1
20 INPUT "NAME"; N$
30 PRINT #1, N$
40 GO TO 20
Note: The peripheral device connected to the RS-232C port should have the same
configuration (3701D).
Before executing this program, you should connect a peripheral device with an
appropriate RS-232C cable to the M100 serial port and use the correct port status.
Once the peripheral device is connected and ready to receive, execute this program.
You will see the prompt:
NAME?
Enter any name, for example
NAME? JONATHAN SMITH
The name will be sent out the serial port and received by the peripheral device.
Another prompt will appear on the display to allow transferring as many names as
desired. You will have to press
(BREAK)
to terminate this program.
Line 18 The OPEN statement specifies the COM: device to be used for output as file
number
1.
The serial port will use 300 baud, 7 data bits, odd parity, 1 stop bit and
XON/XOFF
disabled.
Line 28 The INPUT statement prompts for a name from the keyboard and stores it in
the string variable N$.
Line 38 The name contained in N$ is sent to the serial port by printing to file
number 1.
171

Advertisement

Table of Contents
loading

Table of Contents