Serial, RS232: Difference between revisions

From doityourselfchristmas.com
Jump to navigation Jump to search
(New page: == Achievable distances== <center> <table> <caption>RS232 cable length according to Texas Instruments</caption> <tr><th>Baud rate</th><th>Maximum cable length (ft)</th></tr> <tr align="c...)
 
No edit summary
 
(35 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Overview==
Communication as defined in the RS232 standard is an asynchronous serial communication method. The word serial means, that the information is sent one bit at a time. Asynchronous tells us that the information is not sent in predefined time slots. Data transfer can start at any given time and it is the task of the receiver to detect when a message starts and ends.




== Achievable distances==
 
<center>
 
 
==Voltages==
The signal level of the <strong>RS232</strong> signal can have two states. A high bit, or mark
state is identified by a <em>negative</em> voltage and a low bit or space
state uses a <em>positive</em> value. This might be a bit confusing, because
in normal circumstances, high logical values are defined by high voltages
also. The voltage limitations are shown below.
 
<table>
<table>
<caption>RS232 cable length according to Texas Instruments</caption>
<caption>RS232 voltage values</caption>
<tr><th>Baud rate</th><th>Maximum cable length (ft)</th></tr>
<tr><th>Level</th><th>Transmitter capable (V)</th><th>Receiver capable (V)</th></tr>
<tr align="center" class="odd"><td>19200</td><td>50</td></tr>
<tr><td>Space state (0)</td><td align="center">+5 Vdc up to +15 Vdc</td><td align="center">+3 Vdc up to +25 Vdc</td></tr>
<tr align="center" class="even"><td>9600</td><td>500</td></tr>
<tr><td>Mark state (1)</td><td align="center">-5 Vdc up to -15 Vdc</td><td align="center">-3 Vdc up to -25 Vdc</td></tr>
<tr align="center" class="odd"><td>4800</td><td>1000</td></tr>
<tr><td>Undefined</td><td align="center">-</td><td align="center">-3Vdc  up to +3Vdc </td></tr>
<tr align="center" class="even"><td>2400</td><td>3000</td></tr>
</table>
</table>
</center>
 
==Pinouts==
 
<TABLE>
<TR><TD>View - looking into Male connector</TD><TD>View - looking into Female connector</TD></TR>
<TR><TD>[[Image:Rs232_db9.gif]]</TD><TD>[[Image:Rs232 db9 f.gif]]</TD></TR>
</TABLE>
<TABLE>
<TR><TH>Pin No.</TH><TH>Name</TH><TH>Dir</TH><TH>Notes/Description</TH></TR>
<TR><TD>1</TD><TD>DCD</TD><TD>IN</TD><TD>Data Carrier Detect. Raised by DCE when modem synchronized.</TD></TR>
<TR BGCOLOR="#F0F0F0"><TD>2</TD><TD>RD</TD><TD>IN</TD><TD>Receive Data (a.k.a RxD, Rx). Arriving data from DCE.</TD>
</TR>
<TR><TD>3</TD><TD>TD</TD><TD>OUT</TD><TD>Transmit Data (a.k.a TxD, Tx). Sending data from DTE.</TD></TR>
<TR BGCOLOR="#F0F0F0"><TD>4</TD><TD>DTR</TD><TD>OUT</TD><TD>Data Terminal Ready. Raised by DTE when powered on. In auto-answer mode raised only when RI arrives from DCE.</TD></TR>
<TR><TD>5</TD><TD>SGND</TD><TD>-</TD><TD>Ground</TD></TR>
<TR BGCOLOR="#F0F0F0"><TD>6</TD><TD>DSR</TD><TD>IN</TD><TD>Data Set Ready. Raised by DCE to indicate ready.</TD></TR>
<TR><TD>7</TD><TD>RTS</TD><TD>OUT</TD><TD>Request To Send. Raised by DTE when it wishes to send. Expects CTS from DCE.</TD></TR>
<TR BGCOLOR="#F0F0F0"><TD>8</TD><TD>CTS</TD><TD>IN</TD><TD>Clear To Send. Raised by DCE in response to RTS from DTE.</TD></TR>
<TR><TD>9</TD><TD>RI</TD><TD>IN</TD><TD>Ring Indicator. Set when incoming ring detected - used for auto-answer application. DTE raised DTR to answer.</TD></TR>
</TABLE>
 
== Achievable Distances==
The maximum distance that RS-232 can go varies depending on Baud Rate and also the capacitance of the wire itself. Texas Instruments states that RS-232 maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. Depending on the cable such as Category 5 Twisted pair the maximum achievable distance at 19200 is 157 feet.
 
Here is a chart showing theoretical limits as various data rates for RS-232 cable length according to Texas Instruments.
 
<TABLE>
<TR><TH>  Baud rate  </TH><TH>  Maximum cable length (ft)  </TH></TR>
<TR><TD>19200</TD><TD>50</TD></TR>
<TR BGCOLOR="#F0F0F0"><TD>9600</TD><TD>500</TD></TR>
<TR><TD>4800</TD><TD>1000</TD></TR>
<TR BGCOLOR="#F0F0F0"><TD>2400</TD><TD>3000</TD></TR>
</TABLE>
<BR><BR>
===Advantages===
RS-232 is without doubt the best known interface, because this serial interface is implemented on almost all computers available today.
 
===Disadvantages===
One of the main problems with RS-232 is the lack of immunity for noise on the signal lines.
 
 
However RS-232 suffers from three main problems:
<UL>
<LI>1) it requires multiple ground points and can create potential ground loops.
<LI>2) it picks up noise easily and
<LI>3) it allows only short communication distances.
</UL>
<BR>
In order to overcome some of these issues [[Serial, RS485|RS-422]] or [[Serial, RS485|RS-485]] is the preferred choice.
 
==Interfacing to Microcontrollers==
In order for RS232 to communicate with a Microcontroller such as a Pic16f88 or Atmel, level conversion must first be done because of the voltage levels on TTL is 5 Vdc max and normal RS232 far exceeds voltage limitations and damage will occur.
 
Devices such as a [http://www.maxim-ic.com/quick_view2.cfm?qv_pk=1798 MAX232] will make the necessary voltage conversion possible for communication to and from TTL devices.
 
==External Links==
*[http://www.lammertbies.nl/comm/info/RS-232_specs.html Introduction into RS232 specifications]
*[http://www.maxim-ic.com/appnotes.cfm/an_pk/723/ Selecting and Using RS-232, RS-422, and RS-485 Serial Data Standards]
*[http://en.wikipedia.org/wiki/RS-232 RS-232 Spec form  Wikipedia]
*[http://www.tiaonline.org/about/ Telecommunications Industry Association]
 
 
 
[[Category:Protocols]]
[[Category:General Info]]
[[Category:DIYC Index]]

Latest revision as of 00:08, 29 January 2011

Overview

Communication as defined in the RS232 standard is an asynchronous serial communication method. The word serial means, that the information is sent one bit at a time. Asynchronous tells us that the information is not sent in predefined time slots. Data transfer can start at any given time and it is the task of the receiver to detect when a message starts and ends.



Voltages

The signal level of the RS232 signal can have two states. A high bit, or mark state is identified by a negative voltage and a low bit or space state uses a positive value. This might be a bit confusing, because in normal circumstances, high logical values are defined by high voltages also. The voltage limitations are shown below.

RS232 voltage values
LevelTransmitter capable (V)Receiver capable (V)
Space state (0)+5 Vdc up to +15 Vdc+3 Vdc up to +25 Vdc
Mark state (1)-5 Vdc up to -15 Vdc-3 Vdc up to -25 Vdc
Undefined--3Vdc up to +3Vdc

Pinouts

View - looking into Male connectorView - looking into Female connector
Pin No.NameDirNotes/Description
1DCDINData Carrier Detect. Raised by DCE when modem synchronized.
2RDINReceive Data (a.k.a RxD, Rx). Arriving data from DCE.
3TDOUTTransmit Data (a.k.a TxD, Tx). Sending data from DTE.
4DTROUTData Terminal Ready. Raised by DTE when powered on. In auto-answer mode raised only when RI arrives from DCE.
5SGND-Ground
6DSRINData Set Ready. Raised by DCE to indicate ready.
7RTSOUTRequest To Send. Raised by DTE when it wishes to send. Expects CTS from DCE.
8CTSINClear To Send. Raised by DCE in response to RTS from DTE.
9RIINRing Indicator. Set when incoming ring detected - used for auto-answer application. DTE raised DTR to answer.

Achievable Distances

The maximum distance that RS-232 can go varies depending on Baud Rate and also the capacitance of the wire itself. Texas Instruments states that RS-232 maximum cable length is 50 feet, or the cable length equal to a capacitance of 2500 pF. Depending on the cable such as Category 5 Twisted pair the maximum achievable distance at 19200 is 157 feet.

Here is a chart showing theoretical limits as various data rates for RS-232 cable length according to Texas Instruments.

Baud rate Maximum cable length (ft)
1920050
9600500
48001000
24003000



Advantages

RS-232 is without doubt the best known interface, because this serial interface is implemented on almost all computers available today.

Disadvantages

One of the main problems with RS-232 is the lack of immunity for noise on the signal lines.


However RS-232 suffers from three main problems:

  • 1) it requires multiple ground points and can create potential ground loops.
  • 2) it picks up noise easily and
  • 3) it allows only short communication distances.


In order to overcome some of these issues RS-422 or RS-485 is the preferred choice.

Interfacing to Microcontrollers

In order for RS232 to communicate with a Microcontroller such as a Pic16f88 or Atmel, level conversion must first be done because of the voltage levels on TTL is 5 Vdc max and normal RS232 far exceeds voltage limitations and damage will occur.

Devices such as a MAX232 will make the necessary voltage conversion possible for communication to and from TTL devices.

External Links