The unit COM.PAS enables serial IO from any Turbo Pascal program
using interrupts supporting baudrates upto 115200 baud. It can
address two COM ports at the same time, where each port can be
set individually. So you could use it for baudrate conversions.
Exported procedures and functions are:
InitCom - to initialize the port
ExitCom - to clean-up the port
ComReceived - to check if a byte arrived and was stored in the
ReadCom - to get a byte from the buffer
ComAllowed - to check if control lines and flow control allow
WriteCom - to write a byte to the port
BreakCom - to give a break signal
At initialisation of the COM port, you can set the settings of
the UART (baudrate, data-length, parity and number of stop-bits)
and select the type of flow control (no, rts/cts or xon/xoff).
Also the control lines DTR and RTS will be raised. When hardware
flow control is enabled, RTS will be lowered when the input
buffer gets full. Before writing a byte to the port, the control
lines can be checked. With hardware flow control CTS is part of
that check and should be raised. To check also for CD, the source
must be modified.
The terminal program TTY illustrates how the unit COM.TPU can be
used. It uses only one COM port at a time and it supports
baudrates upto 38400 baud. The largest part of the coding
consists of the user-interface and only a minor part of the
terminal emulator itself. It doesn't support any fancy
escape-sequences for screen handling, because it was more created
for debugging purposes.
Willem van Schaik, May 1994