Electronic interfaces/RS-232
From LabAutopedia
Contents |
EIA/TIA-232E (RS-232)
The Electronics Industries Association (EIA) recommended standard RS-232-C [1] is a standard originally devised for serial binary data signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment) in 1969. It has since become commonly used in computer serial ports. Since 1969, manufacturers adopted simplified versions of this interface for applications that were impossible to envision in the 1960s. The current revision is the Telecommunications Industry Association TIA-232-F Interface Between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Binary Data Interchange, issued in 1997. Because no single "simplified" standard was agreed upon, however, many slightly different protocols and cables were created that obligingly mate with any EIA232 connector, but are incompatible with each other. Most of the difficulties you will encounter in EIA232 interfacing include at least one of the following:
1 - The absence or misconnection of flow control (handshaking) signals.
2 - Incorrect communications function (DTE versus DCE) for the cable in use, resulting in the reversal of the Transmit and Receive data lines as well as one or more handshaking lines.
3 - Incorrect connector gender or pin configuration, preventing cable connectors from mating properly.
Fortunately, EIA232 driver circuitry is highly tolerant of misconnections, and will usually survive a drive signal being connected to ground, or two drive signals connected to each other.
Cables and connectors
The EIA232 standard defines the equipment at the far end of the connection as the DTE device, which has a male DB25 connector, and utilizes 22 of the 25 available pins for signals or ground. Equipment at the near end of the connection is named the DCE device, which has a female DB25 connector, and utilizes the same 22 available pins for signals and ground. The cable linking DTE and DCE devices is a parallel straight-through cable with no cross-overs or self-connects in the connector hoods. If all devices exactly followed this standard, all cables would be identical, and there would be no chance that an incorrectly wired cable could be used. The standard specifies 20 different signal connections, but since most devices use only a few signals, smaller connectors can often be used. For example, the 9 pin DE-9 connector was used by most Windows/Intel PC's since the IBM PC AT, and has been standardized as TIA-574. More recently, modular connectors have been used. Most common are 8 Position 8 Contact (8P8C) connectors, often referred to as RJ45. Standard EIA/TIA 561 specifies a pin assignment.
| RS-232 connector configurations | |||
DB-25 Male
| DB-25 Female
| DE-9 Male | DE-9 Female |
| RS-232 signals and pin assignments (from Wikipedia) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Signal | Origin | Pin # | ||||||||||
| Name | Abbrevation | DTE | DCE | DE-9 | ||||||||
| Common Ground | G | 7 | 5 | 4 | ||||||||
| Transmitted Data | TxD | ● | 2 | 3 | 6 | |||||||
| Received Data | RxD | ● | 3 | 2 | 5 | |||||||
| Data Terminal Ready | DTR | ● | 20 | 4 | 3 | |||||||
| Data Set Ready | DSR | ● | 6 | 6 | 1 | |||||||
| Request To Send | RTS | ● | 4 | 7 | 8 | |||||||
| Clear To Send | CTS | ● | 5 | 8 | 7 | |||||||
| Carrier Detect | DCD | ● | 8 | 1 | 2 | |||||||
| Ring Indicator | RI | ● | 22 | 9 | 1 | |||||||
| Shield | 1 | |||||||||||
| + Voltage | 9 | |||||||||||
| - Voltage | 10 | |||||||||||
| Unassigned | 11 | |||||||||||
| Secondary DCD | ● | 12 | ||||||||||
| Secondary CTS | ● | 13 | ||||||||||
| Secondary TxD | ● | 14 | ||||||||||
| Transmit Element Timing | ● | 15 | ||||||||||
| Secondary Received Data | ● | 16 | ||||||||||
| Receiver Signal Timing | ● | 17 | ||||||||||
| Local Loopback | LL | ● | 18 | |||||||||
| Secondary RTS | ● | 19 | ||||||||||
| Remote Loopback | RL | ● | 21 | |||||||||
| Data Signal Rate Select | ● | ● | 23 | |||||||||
| Ext. Transmit Timing | ● | 24 | ||||||||||
| Test Mode | ● | 25 | ||||||||||
A minimal "3-wire" RS-232 connection consisting only of transmit data, receive data, and ground, is commonly used when the full facilities of RS-232 are not required. Even a two-wire connection (data and ground) can be used if the data flow is one way. When only hardware flow control is required in addition to two-way data, the RTS and CTS lines are added in a 5-wire version. A Modem Cable has the wires in the cable going straight through whereas a Null modem cable has the transmit and receive lines (as well as the handshaking lines) crossed in the cable. An incorrect cable choise will result in a failure to communicate. A “Null Modem Adapter” is a small connector that slips in line with the cable connection to cross the transmit and receive lines (and the handshaking lines) in the cable
The EIA232 standard is applicable to data rates of up to 20,000 bits per second. The standard does not define a maximum cable length but instead defines the maximum capacitance that a compliant drive circuit must tolerate. A widely-used rule-of-thumb indicates that cables more than 50 feet (15 metres) long will have too much capacitance, unless special cables are used. By using low-capacitance cables, full speed communication can be maintained over larger distances of 1,000 feet or more.[2] The maximum distance is a function of the data rate.
Data
The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels. Valid signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level. Logic one (high bit) is defined as a negative voltage, while logic zero (low bit) is positive. The standard specifies a maximum open-circuit voltage of 25 volts; signal levels of ±5 V,±10 V,±12 V, and ±15 V are all commonly seen depending on the power supplies available within a device. Normally data is sent as 7 or 8 bit words. The figure below shows a framed 8 bit data word. A START bit (0-low) marks the beginning of the frame. The data word follows the start bit; a logic one (high) will appear as a low voltage between -3v and -15v when probed on the bus. A parity bit may follow the data word depending on the protocol used. A mark parity bit (always set high) may be used, a space parity bit (always set low) may be used, or an even/odd parity bit may be used. The even parity bit will be a 1 if the number of ones/zeros is even, or a zero if there are an odd number. The odd parity bit will be high if there is an odd number of ones/zeros in the data field. A STOP bit will normally follow the data field or parity bit if used.
| RS-232 Data Format |
|
| Further data format detail.... |
Laboratory use
RS232 is still widely used in laboratory automation, as well as other industries. For laboratory automation systems, the interface provides sufficient speed for most interface needs and is simple and low cost. One drawback is the ability to connect only one device per RS232 port. Relatively inexpensive port expander cards or external expansion boxes are readily available to overcome this limitation. Another limitation is that most current default PC configurations do not include an RS-232 interface port. Adapters are available to convert newer serial ports (e.g. USB) to RS-232 outputs. A major drawback is and always will be the lack of true standardization. Software applications using C/C++, Visual Basic, .NET, Delphi, PowerBuilder or some other Windows application development platform offer plenty of tools for implementing the interface. All of the Microsoft development platforms not only provide simple components or classes for serial communications, they also come with sample source code that demonstrates how to use them.
Most serial devices use very simple protocols for communicating over the RS232 port. A device will typically require that you send it some sort of text command that will “prompt” the device to send back some data. The majority of devices will also transmit all data in a text format that is easily understandable and readable in any text editor. The most difficult devices to work with use complex communications protocol that might require you to calculate checksums, send Ack or Nak responses or require that you convert data received from the device from binary values.
In all cases, it is extremely important to fully understand the particular protocol a device uses. There are no standards that dictate how a particular device or class of devices must work. Detailed user manuals or technical notes are extremely important when implementing this interface.
External Links
Implementing and Debugging RS232 serial connections, [http://www.findguru.com/Implementing-and-Debugging-RS232-Serial-Connections.aspx Scientific Computing
Return to Electronic Interfaces
References
- ↑ Electronics Industries Association, "EIA Standard RS-232-C Interface Between Data Terminal Equipment and Data Communication Equipment Employing Serial Data Interchange", August 1969, reprinted in Telebyte Technology Data Communication Library, Greenlawn NY, 1985, no ISBN
- ↑ A.P. Lawrence Serial Wiring
| Click [+] for other articles on |
| The Market Place for Laboratory Automation | The Market Place |




