You are on page 1of 9

RS 232 Material

RS 232 Material

RS 232 Material

Project: RS-232 to TTL cable


A common feature found on many Microcontrollers is a serial port (often called a SCI, COM,
or ASYNC port). I am going to use the term SCI as a short cut to mean the serial port on your
Microcontroller. Quite often, the SCI on your Microcontroller will generate the appropriate
LOGIC signals to communicate with another chip. They do not, however, generate the proper
voltages required for connecting to RS-232 devices. This article is going to describe the
differences between RS-232 and TTL, and how to build a converter so you can connect your
Microcontroller to an RS-232 compatible device, such as the COM port on your PC.
EIA RS-232-C / CCITT V.28/V.24 101
Standards are a wonderful thing. However, standards beget more standards, numbers, and
classifications. Before you know it, people start talking in terms of standards and their
revision numbers. Such is the case with RS-232. Lots of people can tell you what a 'serial'
port is, but few could quote you the details about the contents of the RS-232-C or CCITT
standards. (I certainly can't!). The RS-232 interface has been around for a very long time. It
specifies the line voltages, connection considerations, baud rates, and a whole slew of other
technical items. Modern day engineers treat RS-232 as an ancient standard handed down
through the generations. Someone probably knows the origins, but most of us just use it as a
given.
"RS-232" is pretty much the standard serial communications interface found on all types of
equipment such as computers, modems, printers, Microcontrollers, eprom programmers, and a
host of other devices. I won't be going into too much detail about the particulars of the RS232 interface other than to point out a key issue to us: The voltages required.
Most microcontrollers run on a single supply voltage, and 99 out of 100 times, that voltage is
+5 volts. In rough terms, logical 1 on these devices indicates that +5 is the voltage on the
output pin. Logical 0 specifies that 0 volts is on the line.
The RS-232-C standard specifies that the voltage on the wire for sending a logical 0 are from
+5v to +15v. The voltage for sending a 1 are from -5v to -15v. Most microcontrollers not
capable of generating these voltages. So, to connect a microcontroller SCI port to a true RS232 device, you need to convert the TTL voltages of 0 and +5 into voltages between about
-10 volts and +10 volts.
You could, if you were so inclined, create something called a voltage doubler, which is
capable of getting you 10 volts. Then, another circuit called a voltage inverter is capable of
generating a negative voltage from that. The solution, of course, is to use a single chip for
both.
MAX232A
Sure enough, the MAX232 is the chip for you. It runs on a single chip supply (+5 volts), and
requires a few external capacitors. There is another version, the MAX233 which requires no
external parts. It is, however, a little larger physically, and also costs about 75% more than the
MAX232A.

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

Here is a diagram of the internals of the MAX232A. It shows a double charge pump voltage
doubler and a +10v to -10v voltage inverter. The voltages output are used to generate the RS232 compliant signals. The MAX232A has provisions for two serial ports on the same
physical package. Most people only connect one of them. You can get a data sheet for the
MAX232 and friends from Maxim. Try downloading MAX232-MAX233 Data Sheets in PDF
format which is a fairly large file (1.2 meg), but has lots of information in it.

MAX232 internals
MAX232 in a Shell
There are two camps on how to implement serial ports on a robot. One says stick the
MAX232 on the robot. The other says don't. I kind of like the don't category! Most of my
robots are autonomous, so I don't really need the MAX232 onboard consuming power. Since
it isn't onboard, it needs to be on its own board. Turns out that a MAX232A fits quite nicely
inside a DB-25 connector shell. The unit is powered by +5 and GND being supplied by the
connection to the microcontroller. This powers the MAX232A.
The MAX232 comes in several varieties. I am using the MAX232A (actually MAX232ACPE
is the full part) because it requires only .1uF capacitors. The original MAX232 required 4.7
and 10uF capacitors, which are bigger and cost more.

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

The photo below shows my stab at putting a MAX232, its capacitors, and the wire inside a
standard DB-25 connector shell . I will add a parts list near the end of this article. This is a
simple circuit to wire up, but I did play a couple of easy tricks. First was that the capacitors
and the MAX232 share perfboard holes. I did this by pushing a screwdriver firmly against the
IC pins at the point where they go through the perfboard. That should give just enough room
to press the leads of the capacitors through the holes. This saved space and also made
soldering these connections really easy. The other trick involves the cable clamp on the wire
exiting the shell. The 4 conductor wire wasn't large enough to be held securely by the cable
clamp. So, I took a rubber band and wrapped it multiple times around the cable, which
enlarged it quite a bit. It now has a nice firm hold on the cable.

The perfboard fits snugly between the connector


rows on the DB-25 (Female/Receptacle). It seems
to work best using connectors that have solder cup
terminals. There is just enough room in the shell
to fit the 16-pin DIP part and a few capacitors. As
you can see on the back view, the board has
slipped right between the solder cups.

The particular wire I chose to use for


the connector to the microcontroller is
a 22 gauge, 4 conductor.

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

i.e. this cable may be used for wiring cellular phone to PC

Microcontrollers serial port (often called a SCI, COM, or ASYNC port) often do not generate
the proper voltages required for connecting to computer RS-232 serial port. In this case
special converter needed. Most microcontrollers run on a single supply voltage, that is usually
+5 volts. In rough terms, logical 1 on these devices indicates that +5 is the voltage on the
output pin. Logical 0 specifies that 0 volts is on the line.
The RS-232-C standard specifies that the voltage on the wire for sending a logical 0 are from
+5v to +15v. The voltage for sending a 1 are from -5v to -15v. Most microcontrollers not
capable of generating these voltages. So, to connect a microcontroller serial port to a true RS232 device, you need to convert the TTL voltages of 0 and +5 into voltages between about
-10 volts and +10 volts.
MAX232 is the chip that makes this work for you. It runs on a single chip supply (+5 volts),
contains double charge pump voltage doubler and a +10v to -10v voltage inverter and
requires a few external capacitors. There are some versions of this chip. The voltages output
are used to generate the RS-232 compliant signals of two serial ports on the same physical
package.

The RS-232 standard requires a modem to be


connected between the receiving and transmitting ends.
This interface is useful for point-to-point
communication at slow speeds. For example, port
COM1 in a PC can be used for a mouse, port COM2
for a modem, etc.

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 was designed for communication of local


devices, and supports one transmitter and one receiver.

Signals Commonly-used signals are:


Transmitted Data (TxD) Data sent from DTE to DCE.
Received Data (RxD) Data sent from DCE to DTE.
Request To Send (RTS) Asserted (set to logic 0, positive voltage) by DTE to prepare DCE
to receive data.
Ready To Receive (RTR) Asserted by DTE to indicate to DCE that DTE is ready to
receive data.
Clear To Send (CTS) Asserted by DCE to acknowledge RTS and allow DTE to transmit
Data Terminal Ready (DTR) Asserted by DTE to indicate that it is ready to be connected.
If the DCE is a modem, this may "wake up" the modem, bringing it out of a
power saving mode.
Data Set Ready (DSR) Asserted by DCE to indicate the DCE is powered on and is ready
to receive commands or data for transmission from the DTE.
Data Carrier Detect (DCD) Asserted by DCE when a connection has been established with
remote equipment.
Ring Indicator (RI) Asserted by DCE when it detects a ring signal from the telephone line
Limitations of RS-232
RS-232 has some serious shortcomings as an electrical interface.
Firstly, the interface pre-supposes a common ground between the DTE and
DCE.
-- This is a reasonable assumption where a short cable connects a DTE and DCE
in the same room, but with longer lines and connections between devices

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

that may be on different electrical busses, this may not be true. We have
seen some spectacular electrical events causes by "uncommon grounds".
Secondly, a signal on a single line is impossible to screen effectively for noise.
-- By screening the entire cable one can reduce the influence of outside noise,
but internally generated noise remains a problem.
-- As the baud rate and line length increase, the effect of capacitance between the cables
introduces serious crosstalk until a point is reached where the data itself is unreadable.
TTL to RS 232C conversion
USART (8251) is not directly compatible with RS-232 signal levels.
The TTL to RS232 Serial Adapter is used to connect TTL (Transistor-Transistor Logic) level
signals to an RS-232 interface.
The TTL side is a 9-pin female connector, and the RS-232 side is a 9-pin male connector.
The TTL side has a voltage suppression network designed to protect against ESD (Electro Static
Discharge) and EFT (Electrical Fast Transient).

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

High-Speed serial communication standards


IEEE 1394 interface:
The IEEE 1394 interface is a serial bus interface standard for high-speed
communications and isochronous real-time data transfer, frequently used by personal
computers, as well as in digital audio, digital video, automotive, and aeronautics
applications.
The ISOCHRONOUS (ISOC) format for data transmission is a procedure or protocol
in which each information CHARACTER or BYTE is individually synchronized or
FRAMED by the use ofSta rt andSto p Elements (bits).
This interface is also known by the brand names ofF ireW ire (Apple Inc.),i.LIN K
(Sony), andLy nx (Texas Instruments).
IEEE 1394 has been adopted as the High-Definition Audio-Video Network Alliance
(HANA) standard connection interface for A/V (audio/visual) component
communication and control.
FireWire is also available in wireless, fiber optic, and coaxial versions using the
isochronous protocols
Nearly all digital camcorders have included a four-circuit 1394 interface
Standards and versions FireWire 400 (IEEE 1394 -1995):
A 6-circuit FireWire 400 alpha connector
The original release of IEEE 1394-1995 specified what is now known as
FireWire 400.
It can transfer data between devices at 100, 200, or 400 Mbit/s half-duplex data rates (the
actual transfer rates are 98.304, 196.608, and 393.216 Mbit/s,
These different transfer modes are commonly referred to as S100, S200, and S400.
Cable length is limited to 4.5 metres (14.8 ft), although up to 16 cables can be daisy chained
using active repeaters.

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

Comparison to USB
Firewire (which started development in 1986) had implementations predating USB.
However USB reached industry standardization (1994) before the IEEE- 1394-1995
specification was released (1995).
At this time USB 1.0 had a signaling speed of 12 and 1.5 Mbit/s (compared to 400 Mbit/s of
IEEE-1394a (FireWire 400)) butch ea per implementations. USB 2.0 with (480 Mbit/s) signal
rate was made available in computers early 2001.
FireWire 800 is substantially faster than Hi-Speed USB, both in theory and in practice.
Alternative uses for IEEE 1394
1. Aircraft
2. Automobiles
USB-Universal Serial Bus
USB is intended to replace many varieties of serial and parallel ports.
USB can connect computer peripherals such as
mice, keyboards, PDAs, gamepads, joysticks, scanners, digital cameras, printers
personal media players, flash drives, external hard drives.
As of 2008, there are about 2 billion USB devices sold per year, and about 6 billion total sold
to date.
The design of USB is standardized by the USB Implementers Forum (USB-IF), an industry
standards body incorporating leading companies from the computer and electronics industries.
Year created: January 1996
Created by: Intel, Compaq, Microsoft, Digital Equipment Corporation, IBM, Northern
Telecom USB communication takes the form of packets.
The original USB 1.0 specification had a data transfer rate of 12 Mbit/s.
The USB 2.0 specification was released in April 2000 and was standardized by the USB-IF at
the end of 2001. Data transfer rate of 480 Mbit/s

The USB 3.0 specification was released on November12, 2008 by the USB 3.0 Promoter
Group. It's maximum transfer rate is up to 10 times faster than the USB 2.0 release. It
has been dubbed the Super USB.

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

RS 232 Material

A USB system has an asymmetric design, consisting of a host, a multitude of downstream USB
ports, and multiple peripheral devices connected in a tiered-star topology.
Additional USB hubs may be included in the tiers, allowing branching into a tree structure
with up to five tier levels.
A USB host may have multiple host controllers and each host controller may provide one or
more USB ports.
Up to 127 devices, including the hub devices, may be connected to a single host controller.
USB devices are linked in series throughhubs. A physical USB device may consist of several
logical sub-devices that are referred to asdevice functions.
A single device may provide several functions, for example, a webcam (video device function)
with a built-in microphone (audio device function). Such a device is called a compound
device in which each logical device is assigned a distinctive address by the host and all
logical devices are connected to a built-in hub to which the physical USB wire is connected.
USB device communication is based onpipes (logical channels).
Pipes are connections from the host controller to a logical entity on the device named an
endpoint.
USB endpoints actually reside on the connected device: the channels to the host are referred
to as pipes USB mass-storage
USB implements connections to storage devices using a set of standards called the USB
mass storage device class (referred to as MSC or UMS).
This was initially intended for traditional magnetic and optical drives, but has been extended to
support a wide variety of devices, particularly flash drives.
This generality is because many systems can be controlled with the familiar idiom of file
manipulation within directories (the process of making a novel device look like a familiar
device is also known as extension).
Though most newer computers are capable of booting off USB mass storage devices.
USB interface port: the drive appears to the user much like an internal drive

RS 232 Material

RS 232 Material

RS 232 Material

You might also like