Getting Started with Serial Communications
By Rob Meredith

[Published in the Fall edition of the APH Technology Update; used with
permission.]

Because more and more information becomes available each day, it is
helpful to know how to transfer information to and from electronic
devices. Serial communication is a common way to transfer information
from one electronic device to another. Understanding serial
communications, even at a basic level, requires knowledge of some
technical concepts: electric connections, communication software and
serial communications parameters.

Making the Connection

The first thing to determine is the type of serial port on each device you
want to connect. Serial ports with holes are said to be female connectors,
while serial ports with pins are called male connectors. Serial ports
usually contain 8, 9 or 25 pins or holes. They can also be custom
connectors of various sizes.

A serial communications port on an IBM (R) PC or compatible computer is a
D-shaped connector, usually on the back of the machine. It has either 9 or
25 pins and is always a male connector. Once you locate the serial port (or
com port), you will need to determine how to connect it to the device with
which you want to exchange data. Some devices are wired differently than
others and often use different connectors. This makes the use of special
adapters and/or cables necessary in many situations.

While 9- and 25-pin male connectors are commonly found on PC
compatibles, some braille embossers also use a 25-pin male connector.
25-pin female connectors are commonly found on external modems, serial
printers, Apple (R) II serial cards and other miscellaneous devices, such
as the APH Pocket Braille and the Kurzweil Personal Reader (R) model
7315. 9-pin female connectors are found on some external modems and on
some external speech synthesizers.

8-pin female connectors, commonly called mini-din 8 connectors, are
round and generally found on Apple equipment like the Apple (R) IIGS (R)
and the Apple Macintosh (R). These connectors are also found on the Braille
Lite 40 (R), the Type 'n Speak (R), and the Braille 'n Speak 2000 (R) from
Blazie Engineering, as well as the Braille 'n Speak Scholar from APH.

An example of a custom serial port can be found on the Braille 'n Speak
Classic, the Braille 'n Speak 640, and the Braille Lite 18. These devices
have an 8-pin male rectangular port and come with a custom cable for
connecting the serial port to other devices.

Serial Cables

Note that PC-compatible machines use a 25-pin female connector for the
parallel port. Do not attempt to connect a serial device to this port. Also
remember that it is unwise to connect anything to a port if its type is
unknown.

After you find the serial port on the device you want to connect,
determine how to connect it to your PC. You will need a serial cable.
Unless you are connecting to a device which has a custom or 8-pin port, a
common type of serial cable known as a straight through is usually
sufficient. If you have an external modem, and it is working, you probably
have a straight through cable already. If not, you can get one at Radio
Shack (R) or another computer hardware supply store.

If you want to connect with a device that has a custom port, contact the
manufacturer of the device to find out where to get the cable you need.
The Braille 'n Speak 640, for example, requires a custom cable that is
supplied with the unit.

Adapters

In addition to a serial cable, you may need one or more adapters to
properly make the connection with your PC. One common type of adapter is
called a gender changer (believe it or not!). The gender changer converts a
port or the end of a cable from a female connector to a male connector, or
vice versa. These are most commonly available in a 25-pin configuration.

Another common adapter is called a null modem adapter. These adapters
also come most often in a 25-pin configuration and have a male connector
on one end and a female connector on the other.

Serial devices fall into two broad classes: Data Terminal Equipment (DTE)
and Data Communication Equipment (DCE). When using a computer and
modem, for example, the classification is self-explanatory. The computer
is the Data Terminal Equipment and the modem is the Data Communication
Equipment. When using devices other than modems with your PC, however,
the classification is less clear. Devices are wired differently, depending
on whether they are to be used as Data Terminal Equipment or Data
Communication Equipment. A null modem adapter makes it possible to
connect equipment which is of the same type.

For example, most serial printers are wired as Data Terminal Equipment.
So is your PC. If you want to connect a serial printer wired as DTE to your
PC and you are using a straight-through serial cable, you will need a null
modem adapter to make the
connection.

It is often hard to tell, just by looking at a device, whether you will need
a null modem. A good rule of thumb is: if you have connected two serial
devices and they don't seem to communicate at all, try a null modem
adapter.

Two serial devices with confusing classification are the Braille 'n Speak
and the Kurzweil Personal Reader (R) model 7315. The Braille 'n Speak
with its custom cable attached is wired as Data Communication
Equipment. This seems odd, because it would appear to be more like a
terminal than a modem. Probably this wiring was done so the Braille 'n
Speak could be connected easily to a serial printer. If you want to connect
a Braille 'n Speak to a 25-pin serial port on a PC, you need a 25-pin female
gender changer. The gender changer is required because the Braille 'n
Speak serial cable and the PC both have male connectors. To connect a
Braille 'n Speak to a PC with a 9-pin serial port, you need either an
adapter which converts a 9-pin port to a 25-pin port or a straight-through
9-pin female to 25-pin male cable, such as the kind found on most
external modems.

Although it may seem quite odd, you will need a null modem adapter to
connect the Braille 'n Speak to a modem. Modems are rarely seen with null
modem adapters connected, but the Braille 'n Speak cable is wired in a
way that requires the null modem adapter.

Most people would probably guess that the Kurzweil Personal Reader
model 7315 with its 25-pin female serial port would be wired as Data
Terminal Equipment. However, it is wired as Data Communication
Equipment. Probably, this was done to enable simple connection to a
device, such as a PC, using a 25-pin straight-through cable. If you have an
external modem on your PC, just remove the cable from the modem and
plug it into the Personal Reader. It will work.

Communications Software

In order to move information from one device to another, each device will
need a program to manage the transfer. Most notetaking and stand-alone
devices have communications software built in. Refer to the manual that
came with your device to learn how to transfer information through its
serial port.

When transferring information between a PC and another device, you need
to run some software on the PC. Many different programs, often called
telecommunications or terminal programs, can do this. Common examples
of telecommunications programs include Commo (R), Hyper-Terminal (R),
PROCOMM (R) and Telix (R). Also, smaller utility programs can do the job. A
freeware package that I developed, called Send and Rcv, is on the APH
Website at http://www.aph.org.

Serial Communication Parameters

Aside from connecting two serial devices and finding appropriate
communications software, you need to consider parameters. This aspect of
serial communications intimidates most people because of the number of
parameters that must be considered to exchange information correctly.
These parameters are: baud rate, data bits, stop bits, parity and
handshaking.

In general, both serial devices must be set up to use the same parameter
values. For example, if one device is configured to use 9600 baud, the baud
rate setting of the other device should match. Knowing each parameter
will enable you to exchange information correctly.

Understanding the Parameters

The baud rate is the speed at which data is to be communicated. It is also
referred to as bits per second (BPS), which is more correct than baud.
Most devices can use baud rates from 2,400 to 9,600. The PC serial port
can use baud rates from 110 to 115,200, but a fairly fast computer is
required to use a high baud rate.

The data bits setting refers to the number of bits that make up each
character. This setting generally ranges from 5 to 8, with 8 and 7 being
the most common. It is rare for a device to use 5 or 6 data bits.

The stop bits setting is the number of bits inserted after a character. This
setting is actually a delay, with 1 being a pause equal to one bit and 2
being a pause equal to two bits. A setting of 1 is most common.

Parity is a form of error detection. When parity is set to none, the most
common setting, no extra bit is sent after the character bits to
communicate parity. Other parity settings include even, odd, space and
mark. Although the meaning of these settings is beyond the scope of this
article, both devices should be set the same way to detect parity errors
properly. In most cases you should use no parity.

Finally, handshaking is a method by which one device tells another to
temporarily stop the flow of data. To understand handshaking, imagine
pouring an entire glass of water directly into a funnel. The funnel would
quickly overflow, and water intended for the funnel would be lost. With
handshaking, the funnel could tell the glass to stop pouring for a second,
then tell it to resume again after most of the water has emptied from the
funnel.

There are two main kinds of handshaking, software handshaking and
hardware handshaking. Software handshaking (Xon/Xoff handshaking) is the
simplest of the two and works well for most serial communications.
Software handshaking is based on one device telling the other to stop by
sending a special character.

Hardware handshaking is based on one device stopping another by sending
an electrical signal through a wire. Because a wire is required, hardware
handshaking is more difficult to achieve. Some serial ports have more pins
than others, and some serial cables and adapters are wired differently
than others. Hardware handshaking is more precise and is often required in
situations where high baud rates are used or when programs rather than
text files are being transmitted.

Another problem with hardware handshaking is determining which line in
the cable is used. In general, there are two kinds of hardware handshaking:
DTR/DSR handshaking and RTS/CTS handshaking. If a device has an option
called simply hardware handshaking, without a little experimentation it is
often impossible to know which kind of hardware handshaking the device
uses.

Choosing Settings

When exchanging information between two serial devices, choose settings
based on two factors: the setting values both devices have in common and
the ability of each device to deal with the selected baud rate. For most
situations, the following settings should be used:

Baud:	9,600
Data bits:	8
Stop bits:	1
Parity:	None
Handshaking:	Software.

After you have successfully transferred data using these settings, you
may want to experiment with others. The higher the baud rate, the faster
the transfer. If you can get hardware handshaking to work, use it instead
of software handshaking. Always opt for 1 stop bit and no parity when
possible. Also, remember the receiver generally does a lot more work than
the sender. So, if you are sending to a slow device, high baud rates will
not be possible.

Duplex

While duplex (local echo) is not a true serial parameter, it often becomes
an issue while using serial communications. Most terminal programs have
a duplex setting, which is usually set to "full." If the program you are
using has a setting called "local echo" instead of duplex, it will usually be
set to "no." Full duplex means characters you type are not printed on the
screen directly but are echoed back from the device or service you are
connected to. A setting of half means that characters you type are printed
on the screen directly and are assumed not to be echoed back from the
connected device or service.

You will also find a duplex option on most notetaking devices. This option,
similar to the one found in terminal programs, usually has three settings-
-half duplex, full duplex and no duplex. Generally, notetakers are used with
a half duplex setting. Half duplex means that characters you type into the
notetaker are stored in the currently open file and sent out the serial port.
Full duplex means that characters you type are only sent out the serial
port. A setting of no duplex, a useless setting, means that characters you
type go nowhere.

A Word About Linefeeds

A linefeed is a special character that causes a printer to advance by one
line or a display to scroll up by one line. While linefeeds have nothing to
do with serial communications in a pure sense, you should know some
devices use them differently than others. In general, only files edited on a
PC contain linefeeds. Therefore, when sending a file from a notetaker to a
PC, the notetaker should be instructed to add (or append) linefeeds to the
output after each carriage return. This is also true when printing because
most printers require linefeeds.

A Practical Example--Putting Knowledge About Serial Communications to
Work

Imagine you want to move a file from your Braille 'n Speak to your PC
using the Send and Rcv package available on the APH Website.

Begin by connecting the two devices. Connect the Braille 'n Speak cable to
the Braille 'n Speak serial port, and connect the other end of the cable to a
25-pin gender changer. If you have a 25-pin serial port on your PC, simply
connect the gender changer to the port. If you have a 9-pin serial port,
obtain an appropriate adapter or use a 9-pin female to a 25-pin male
straight-through serial cable.

To prepare the Braille 'n Speak for sending, enter the status menu by
pressing dots 3-4 chord. Then, press F to move to the serial port on/off
setting. Press Y to turn on the port, then move to the next item in the
status menu, the baud rate, with dot 4 chord. Press 9 (dots 3-5) to select
9600 baud.

Move to the next item, the parity setting, and press N for none. Move to the
next item, duplex, and press H for half. The next setting is data bits; press
8 here. Move to the next setting, stop bits, and press 1. For the next
setting, handshaking, press S for software handshake. Last is the append
linefeeds setting; press Y. To exit the status menu, press E chord.

To prepare your PC for receiving the file, be sure the Send and Rcv
programs are in your DOS path. Then type "rcv /c<port number> <file
name>" and press Enter. Use the number of your com port after /c, and use
the file name you prefer. For example, if you are using com2 and you wish
to name your file "notes.txt", you would type: rcv /c2 notes.txt.

Now, tell the Braille 'n Speak to send the file. To do this, open the file and
press T chord then A. The Braille 'n Speak will say "ok" when the transfer
is complete. After hearing "ok", press Escape on the PC to tell Rcv to stop
receiving. Then turn off the Braille 'n Speak serial port by pressing P
chord, followed by dots 2-6, followed by the letter N. You should now have
on your PC a text file containing the same information as the Braille 'n
Speak file.
