QUAD & DUAL SERIAL PORTS
DESCRIPTION
Add four extra serial
ports to a TDS2020F in addition to
the two already present. The SC28C94 quad serial port UART chip from
Philips/Signetics is supported by file #QUART.TDS. Use the SC26C92 chip and file
#DUART.TDS to add only to serial ports.
The ports can be RS232,
RS485 or RS422 depending on which driver chips are added. Full CTS and RTS
hardware handshaking is available. There is a buffer of 8 bytes on each of
the four transmitters and on receive a circular buffer that is user
defined-nominally 82 bytes. All four receivers and transmitters can be
used simultaneously in real-time applications. Baud rates from 50 to 38,400 are
available. Interactive Forth can be
redirected to any port and that can be used for further compilation if
required.
Adding four extra serial ports Click the diagram for more detail, or to save a copy: 1. in Internet Explorer right click on the picture and select "Save Target as..." 2. in Netscape double-click the picture to open the file, then under "File" select the "Save As" option.
HARDWARE
The Quad UART (QUART) chip
has four transmitters, four receivers and baud rate generators. Serial I/O
is at +5V/0V logic levels and you need to add driver chips like the MAX238 from
Maxim. For each of the four serial ports two input and two output driver gates
are needed if full hardware handshaking is required. Each MAX238 has four of
each so two of these chips will suffice in a substantial RS232 implementation.
In addition two 74HC gate chips are needed for address decoding. A suitable
circuit is shown here. Tie the 74HC138 inputs A B & C to
ground and its pin 15 output will be a suitable chip select for the QUART, being
enabled for the address range 08100 to 0813F.
RESOURCES USED
Interrupt request line 0
(IRQ0 on Port 1 bit 5, pin c26) is used as a common interrupt
for all four receiving UARTs. The QUART occupies 64 bytes of memory space.
The areas hex 08000-813F and 08200-087FF on TDS2020F are available for such external
peripherals. No other I/O lines are needed.
SOFTWARE
Extended Memory is used
by #QUART.TDS for all variables and the four receive buffers. You need a RAM
chip in the 32-pin socket. Data is accepted under interrupt. Characters
will not be missed at 38,400 baud, even when the Forth program is busy
doing other work. Received characters are stored in a circular buffer until
needed. Adjust QBAG to set the position of
the input buffer in RAM and QBAG-SIZE to fix the total length of the four buffers. Each buffer should be made
long enough to accept serial input for the time that the processor may be away
doing other things, for example writing to a PCMCIA hard disk.
The word QSHELTER should be used for initialisation in the word
executed at power-up.
The address of the QUART
in the memory space can be changed by editing the constant QBASE .
The naming of the I/O
words follows the pattern of other serial ports, but each takes a parameter to
specify the channel in the QUART. For example 2 [QKEY] waits for
a byte to be input on channel 2. Note that the software names the channels
0 to 3 but the chip data sheet calls them by letters
A to D.
There is no problem to use #QUART.TDS in conjunction with these files:
#CARD.TDS
|
RAM Card Memory
without DOS format.
|
#DOSRAM.TDS
|
RAM Card Memory with
DOS format.
|
#CARDHD.TDS
|
PCMCIA-ATA hard disk
or Flash cards without DOS format
|
#DOSHD.TDS
|
PCMCIA-ATA hard disk
or Flash cards with DOS format
|
#DOSDUAL.TDS
|
hard disk/Flash cards
with fast interrupt data logging
|
However you may need to
alter the position where extended memory variables are put. This is done by
editing the included file #EXTVAR.TDS.
INSTRUCTIONS FOR USE
1. Construct
the circuit shown (also available as file #QUART.GIF on the CD in the directory
\cd).
2. Edit
the constant
QBASE if the location in the memory map has been changed from the
default hex 08100.
3. Edit
the constant
QBAG-SIZE to four times the longest burst of incoming data,
82 bytes for each of the four buffers by default.
4. Edit QBAUD
, deleting lines corresponding to unused baud rates.
5. If
you want full CTS/RTS handshaking, in QSHELTER , seven code lines
from the end, change $07 SWAP PC! to $17 SWAP PC!
6. For
demonstration and test connect a terminal to the TDS2020F Port 1 (as used for compilation) and another to quad UART
Port 0. TDS-PC for Windows is
suitable for both ends.
7. Compile
file #QUART.TDS type SET START then Q2WAY return. When you type on one terminal the text will display on the
other. Stop the test by pressing ctrl+C on the TDS2020F Port 1 terminal.
|