Classifieds/Sell/Trade/Buy
Message Boards
Icom America
Kenwood
Yaesu
ARRL
FCC
   Random Amatuer Radio Pictures

RS232 Serial Communications

Everything you need to know about RS232 serial communications.
(This is necessary for radio to computer communications.)

Most PC computers are typically equipped with at least one serial port and one parallel port. Although these two types of ports are used for communicating with external devices, they work in different ways.

A parallel port sends and receives data eight bits at a time over 8 separate wires. This allows data to be transferred quickly. But the cable required is more bulky because of the number of individual wires it must contain. Parallel ports are typically used to connect a PC to a printer and are rarely used for much else. A serial port sends and receives data one bit at a time over one wire. While it takes eight times as long to transfer each byte of data this way, only a few wires are required. Two-way (full duplex) communications is possible with only three separate wires; one to send, one to receive, and a common signal ground wire.

Bi-directional Communications
Baud vs. Bits Per Second
Communication By Bits
Cables, Null Modems, And Gender Changers
The Parity Bit
Cable Lengths
RS-232C
Gender Changers
DCE And DTE Devices
Null Modem Cables and Adapters
9 Pin To 25 Pin Adapters
Synchronous And Asynchronous Communications
PC Keyboard Pinouts
RS232 RJ45 Interface
USB Type A and B
Mini USB Type B
IEEE 1394 - FireWire

Bi-directional Communications

The serial port on your PC is a full-duplex device meaning that it can send and receive data at the same time. In order to be able to do this, it uses separate lines for transmitting and receiving data. Some types of serial devices support only one-way communications and therefore use only two wires in the cable - the transmit line and the signal ground.
Back to Top

Baud vs. Bits

The baud unit is named after Jean Maurice Emile Baudot, who was an officer in the French Telegraph Service. He is credited with devising the first uniform-length 5-bit code for characters of the alphabet in the late 19th century. What baud really refers to is modulation rate or the number of times per second that a line changes state. This is not always the same as bits per second (BPS). If you connect two serial devices together using direct cables then baud and BPS are in fact the same. Thus, if you are running at 19200 BPS, then the line is also changing states 19200 times per second. But when considering modems, this isn't the case.

Because modems transfer signals over a telephone line, the baud rate is actually limited to a maximum of 2400 baud. This is a physical restriction of the lines provided by the phone company. The increased data throughput achieved with 9600 or higher baud modems is accomplished by using sophisticated phase modulation, and data compression techniques.
Back to Top


Communication By Bits

Once the start bit has been sent, the transmitter sends the actual data bits. There may either be 5, 6, 7, or 8 data bits, depending on the number you have selected. Both receiver and the transmitter must agree on the number of data bits, as well as the baud rate. Almost all devices transmit data using either 7 or 8 databits.

Notice that when only 7 data bits are employed, you cannot send ASCII values greater than 127. Likewise, using 5 bits limits the highest possible value to 31. After the data has been transmitted, a stop bit is sent. A stop bit has a value of 1 - or a mark state - and it can be detected correctly even if the previous data bit also had a value of 1. This is accomplished by the stop bit's duration. Stop bits can be 1, 1.5, or 2 bit periods in length.
Back to Top


Cables, Null Modems, And Gender Changers

In a perfect world, all serial ports on every computer would be DTE devices with 25-pin male "D" connectors. All other devices to would be DCE devices with 25-pin female connectors. This would allow you to use a cable in which each pin on one end of the cable is connected to the same pin on the other end. Unfortunately, we don't live in a perfect world. Serial ports use both 9 and 25 pins, many devices can be configured as either DTE or DCE, and - as in the case of many data collection devices - may use completely non standard or proprietary pin-outs. Because of this lack of standardization, special cables called null modem cables, gender changers and custom made cables are often required.
Back to Top


The Parity Bit

Besides the synchronization provided by the use of start and stop bits, an additional bit called a parity bit may optionally be transmitted along with the data. A parity bit affords a small amount of error checking, to help detect data corruption that might occur during transmission. You can choose either even parity, odd parity, mark parity, space parity or none at all. When even or odd parity is being used, the number of marks (logical 1 bits) in each data byte are counted, and a single bit is transmitted following the data bits to indicate whether the number of 1 bits just sent is even or odd.

For example, when even parity is chosen, the parity bit is transmitted with a value of 0 if the number of preceding marks is an even number. For the binary value of 0110 0011 the parity bit would be 0. If even parity were in effect and the binary number 1101 0110 were sent, then the parity bit would be 1. Odd parity is just the opposite, and the parity bit is 0 when the number of mark bits in the preceding word is an odd number. Parity error checking is very rudimentary. While it will tell you if there is a single bit error in the character, it doesn't show which bit was received in error. Also, if an even number of bits are in error then the parity bit would not reflect any error at all.

Mark parity means that the parity bit is always set to the mark signal condition and likewise space parity always sends the parity bit in the space signal condition. Since these two parity options serve no useful purpose whatsoever, they are almost never used.
Back to Top


Cable Lengths

The RS-232C standard imposes a cable length limit of 50 feet. You can usually ignore this "standard", since a cable can be as long as 10000 feet at baud rates up to 19200 if you use a high quality, well shielded cable. The external environment has a large effect on lengths for unshielded cables. In electrically noisy environments, even very short cables can pick up stray signals. The following chart offers some reasonable guidelines for 24 gauge wire under typical conditions. You can greatly extend the cable length by using additional devices like optical isolators and signal boosters. Optical isolators use LEDs and Photo Diodes to isolate each line in a serial cable including the signal ground. Any electrical noise affects all lines in the optically isolated cable equally - including the signal ground line. This causes the voltages on the signal lines relative to the signal ground line to reflect the true voltage of the signal and thus canceling out the effect of any noise signals.

Baud Rate

Shielded Cable Length

Unshielded Cable Length

110

5000

1000

300

4000

1000

1200

3000

500

2400

2000

500

4800

500

250

9600

250

100


Back to Top


RS-232C

RS-232 stands for Recommend Standard number 232 and C is the latest revision of the standard. The serial ports on most computers use a subset of the RS-232C standard. The full RS-232C standard specifies a 25-pin "D" connector of which 22 pins are used. Most of these pins are not needed for normal PC communications, and indeed, most new PCs are equipped with male D type connectors having only 9 pins.
Back to Top


Gender Changes

A problem you may encounter is having two connectors of the same gender that must be connected. You can purchase gender changers at any computer or office supply store for under $5.

Note: The parallel port on a PC uses a 25 pin female connector which sometimes causes confusion because it looks just like a serial port except that it has the wrong gender. Both 9 and 25 pin serial ports on a PC will always have a male connector.
Back to Top


DCE And DTE Devices

Two terms you should be familiar with are DTE and DCE. DTE stands for Data Terminal Equipment, and DCE stands for Data Communications Equipment. These terms are used to indicate the pin-out for the connectors on a device and the direction of the signals on the pins. Your computer is a DTE device, while most other devices are usually DCE devices.

If you have trouble keeping the two straight then replace the term "DTE device" with "your PC" and the term "DCE device" with "remote device" in the following discussion.

The RS-232 standard states that DTE devices use a 25-pin male connector, and DCE devices use a 25-pin female connector. You can therefore connect a DTE device to a DCE using a straight pin-for-pin connection. However, to connect two like devices, you must instead use a null modem cable. Null modem cables cross the transmit and receive lines in the cable, and are discussed later in this chapter. The listing below shows the connections and signal directions for both 25 and 9-pin connectors.

25 Pin Connector on a DTE device (PC connection)

Male RS232 DB25

25 pin to 9 pin connector

Pin Number

Direction of signal:

1

Protective Ground

2

Transmitted Data (TD) Outgoing Data (from a DTE to a DCE)

3

Received Data (RD) Incoming Data (from a DCE to a DTE)

4

Request To Send (RTS) Outgoing flow control signal controlled by DTE

5

Clear To Send (CTS) Incoming flow control signal controlled by DCE

6

Data Set Ready (DSR) Incoming handshaking signal controlled by DCE

7

Signal Ground Common reference voltage

8

Carrier Detect (CD) Incoming signal from a modem

20

Data Terminal Ready (DTR) Outgoing handshaking signal controlled by DTE

22

Ring Indicator (RI) Incoming signal from a modem


9 Pin Connector on a DTE device (PC connection)

Male RS232 DB9

9 pin D connector

Pin Number

Direction of signal:

1

Carrier Detect (CD) (from DCE) Incoming signal from a modem

2

Received Data (RD) Incoming Data from a DCE

3

Transmitted Data (TD) Outgoing Data to a DCE

4

Data Terminal Ready (DTR) Outgoing handshaking signal

5

Signal Ground Common reference voltage

6

Data Set Ready (DSR) Incoming handshaking signal

7

Request To Send (RTS) Outgoing flow control signal

8

Clear To Send (CTS) Incoming flow control signal

9

Ring Indicator (RI) (from DCE) Incoming signal from a modem


Back to Top


Null Modem Cables and Adapters

If you connect two DTE devices (or two DCE devices) using a straight RS232 cable, then the transmit line on each device will be connected to the transmit line on the other device and the receive lines will likewise be connected to each other. A Null Modem cable or Null Modem adapter simply crosses the receive and transmit lines so that transmit on one end is connected to receive on the other end and vice versa. In addition to transmit and receive, DTR & DSR, as well as RTS & CTS are also crossed in a Null modem connection.

Simple Null Modem without Handshaking

Simple RS232 Null Modem Pinout without Handshaking

Simple Null Modem with Loopback Handshaking

Simple RS232 Null Modem Pinout with Loopback Handshaking

Simple Null Modem with Partial Handshaking

Simple RS232 Null Modem Pinout with Partial Handshaking

Simple Null Modem with Full Handshaking

Simple RS232 Null Modem Pinout with Full Handshaking

Null modem adapter are available at most computer and office supply stores for under $5.
Back to Top


9 Pin To 25 Pin Adapters

The following table shows the connections inside a standard 9 pin to 25 pin adapter (converter).

RS232 DB9 to DB25 Adapter

9-Pin Connector

25 Pin Connector

Pin 1 DCD

Pin 8 DCD

Pin 2 RD

Pin 3 RD

Pin 3 TD

Pin 2 TD

Pin 4 DTR

Pin 20 DTR

Pin 5 GND

Pin 7 GND

Pin 6 DSR

Pin 6 DSR

Pin 7 RTS

Pin 4 RTS

Pin 8 CTS

Pin 5 CTS

Pin 9 RI

Pin 22 RI


Back to Top


Synchronous And Asynchronous Communications

There are two basic types of serial communications, synchronous and asynchronous. With Synchronous communications, the two devices initially synchronize themselves to each other, and then continually send characters to stay in sync. Even when data is not really being sent, a constant flow of bits allows each device to know where the other is at any given time. That is, each character that is sent is either actual data or an idle character. Synchronous communications allows faster data transfer rates than asynchronous methods, because additional bits to mark the beginning and end of each data byte are not required. The serial ports on IBM-style PCs are asynchronous devices and therefore only support asynchronous serial communications.

Asynchronous means "no synchronization", and thus does not require sending and receiving idle characters. However, the beginning and end of each byte of data must be identified by start and stop bits. The start bit indicate when the data byte is about to begin and the stop bit signals when it ends. The requirement to send these additional two bits cause asynchronous communications to be slightly slower than synchronous however it has the advantage that the processor does not have to deal with the additional idle characters.

An asynchronous line that is idle is identified with a value of 1, (also called a mark state). By using this value to indicate that no data is currently being sent, the devices are able to distinguish between an idle state and a disconnected line. When a character is about to be transmitted, a start bit is sent. A start bit has a value of 0, (also called a space state). Thus, when the line switches from a value of 1 to a value of 0, the receiver is alerted that a data character is about to come down the line.

Back to Top


PC Keyboard Pinouts

PS/2 Keyboard or Mouse

PC/AT Keyboard

Mating face of 6 pin male firewire
6 pin miniDIN female

Mating face of 6 pin male firewire
5 pin DIN female

PIN#

SIGNAL

PIN#

SIGNAL

PIN#

SIGNAL

PIN#

SIGNAL

1

DATA

4

+5

1

CLOCK

4

GND

2

NC

5

CLOCK

2

DATA

5

+5

3

GND

6

NC

3

NC

 

 


Back to Top

RS232 RJ45 Interface

USB type B receptacle

Female RS232 RJ45

PIN#

SIGNAL

PIN#

SIGNAL

1

RTS

5

GND

2

DTS

6

RXD

3

TXD

7

DSR

4

GND

8

CTS


Back to Top

USB Type A and B

USB type A receptacle
USB type A female

USB type B receptacle

USB type B female

PIN#

SIGNAL

PIN#

SIGNAL

1

+5

3

+Data

2

-Data

4

GND


Back to Top

Mini USB Type B

Mating face of Mini USB Type B female
5 pin Mini USB Type B female

Mating face of Mini USB Type B female       Mating face of Mini USB Type B female

4 pin Mini USB Type B female

PIN#

SIGNAL

PIN#

SIGNAL

1

+5

1

+5

2

-DATA

2

-DATA

3

+DATA

3

+DATA

4

NC

4

GND

5

GND

 

 


Back to Top

IEEE 1394FireWire

Mating face of 6 pin male firewire
6 pin male FireWire

Mating face of 6 pin male firewire
4pin male FireWire

PIN#

SIGNAL

PIN#

SIGNAL

1

POWER

1

TPB-

2

GND

2

TPB+

3

TPB-

3

TPA-

4

TPB+

4

TPA+

5

TPA-

 

 

6

TPA+

 

 


Back to Top

IC-746 Pro Ham Radio
Popular Callsign Lookups
for this month:

KC2OBW
N9SQM
KD7KHY

KE5BYF

Stewart Warner R113
Stewart Warner 301-A
738 Silver Marshall
IR Widget
Reading Morse Code on your PC
FCC Datbase Lookup
Pixie Transceiver
PSK31 Circuit Interface
The Iambic Mouse
MaxTrac 900 Ham Conversion
GE MVP Ham Conversion
Weather Station
ICOM OPC-478 Interface
PIC to Network
Morse Code Decoder Circuit