Thursday, June 11, 2009

RS 232

The serial port is prevalent on PC's as well as scores of industrial, scientific and consumer devices, making it a convenient starting point for communications. Since RS-232 itself is only suited to short connections (50 ft. max.) many applications require that it be adapted to fit requirements. RS-422, typically used for extending RS-232 communications, provides full duplex communications between two devices. It can also provide one way communications from one master to several slaves. RS-485 communications standard allows cable lengths up to 4000 feet. It also provides very high noise immunity. Multidrop connections up to 32 different nodes can be made over a single twisted pair cable along with a signal ground connection.

This article summarizes the choices a system designer has when adding a serial (RS-232, RS-422, or RS-485) communications device. There are many different ways to add additional serial ports to your Desktop PC, Palm, or Laptop PC. USB, PCMCIA, PCI and ISA are some of the methods that will be discussed.

The Universal Serial Bus (USB) provides a high data rate and Hot Swap connection for PCs, providing an easy connection to a wide variety of multimedia and network USB devices. Generally considered to be for home or office use, USB is finding its way into Industrial applications.

PCMCIA Serial Ports are yet another way to add serial ports to a PC that has PCMCIA Slots available. Most Laptops today offer only one (if any at all) DB9 type serial ports. A PCMCIA Serial Card is a good way to add a serial port (or ports) to any laptop that is low on available serial ports (RS-232, RS-422 or RS-485).

PCI Cards are becoming more popular as a way to add serial ports to desktop PC's. PCI type slots are becoming the "norm" in standard PC's today, and PCI Serial Cards are an excellent way to add serial ports. The standard Desktop PC may only come with one serial port standard (if any serial ports at all). PCI Serial Cards use Software Drivers to address the ports to the PC.

ISA Cards are yet another way to add serial ports to the older desktop PC's. ISA type slots are becoming scarce in standard PC's today, but are still an excellent way to add serial ports. The ISA Cards are typically addressed using dipswitches and shunts or jumpers to set IRQ's for each port. No Software Drivers are required with ISA style serial cards.

Palm OS PDA's may be connected to RS-422 or RS-485 data circuits using Palm adapters. These adapters offer total portability for collecting data and field service chores. The Palm device and the adapter will usually slip into a shirt pocket. Some models use the PDA's connecting cable, some include a cable and some are cradles that allow the PDA to nest in place and connect directly to the Palm base socket. PalmTerm Freeware allows you to transmit and receive data from the Palm serial port.

Cable Selection for RS-422 and RS-485 Systems

Selecting data cable for an RS-422 or RS-485 system isn't difficult, but often gets lost in the shuffle of larger system issues. Care should be taken, however, because intermittent problems caused by marginal cable can be very difficult to troubleshoot.

Beyond the obvious traits such as number of conductors and wire gauge, cable specifications include a handful of less intuitive terms.

Characteristic Impedance (Ohms): A value based on the inherent conductance, resistance, capacitance and inductance of a cable that represents the impedance of an infinitely long cable. When the cable is cut to any length and terminated with this Characteristic Impedance, measurements of the cable will be identical to values obtained from the infinite length cable. That is to say that the termination of the cable with this impedance gives the cable the appearance of being infinite length, allowing no reflections of the transmitted signal. If termination is required in a system, the termination impedance value should match the Characteristic Impedance of the cable.

Shunt Capacitance (pF/ft): The amount of equivalent capacitive load of the cable, typically listed in a per foot basis. One of the factors limiting total cable length is the capacitive load. Systems with long lengths benefit from using low capacitance cable.

Propagation velocity (% of c): The speed at which an electrical signal travels in the cable. The value given typically must be multiplied by the speed of light (c) to obtain units of meters per second. For example, a cable that lists a propagation velocity of 78% gives a velocity of 0.78 x 300 x 106 = 234 x 106 meters per second.
Plenum cable

Plenum rated cable is fire resistant and less toxic when burning than non-plenum rated cable. Check building and fire codes for requirements. Plenum cable is generally more expensive due to the sheathing material used.

The RS-422 specification recommends 24AWG twisted pair cable with a shunt capacitance of 16 pF per foot and 100 ohm characteristic impedance. While the RS-485 specification does not specify cabling, these recommendations should be used for RS-485 systems as well.

It can be difficult to quantify whether shielding is required in a particular system or not, until problems arise. We recommend erring on the safe side and using shielded cable. Shielded cable is only slightly more expensive than unshielded.

There are many cables available meeting the recommendations of RS-422 and RS-485, made specifically for that application. Another choice is the same cable commonly used in the twisted pair Ethernet cabling. This cable, commonly referred to as Category 5 cable, is defined by the EIA/TIA/ANSI 568 specification. The extremely high volume of Category 5 cable used makes it widely available and very inexpensive, often less than half the price of specialty RS-422/485 cabling. The cable has a maximum capacitance of 17 pF/ft (14.5 pF typical) and characteristic impedance of 100 ohms.

Category 5 cable is available as shielded twisted pair (STP) as well as unshielded twisted pair (UTP) and generally exceeds the recommendations for RS-422 making it an excellent choice for RS-422 and RS-485 systems.

For more information on serial communications, including RS485 systems issues, we recommend Serial Port Complete by Jan Axelson.

Basics of the RS-485 Standard

This information touches on some of the most commonly asked aspects of RS-485 communications. B&B Electronics has a free application note available on RS-422/485 that gives a more complete picture of RS-485 networks. Request B&B's RS-422/485 Application Note, available by mail or on our websites, www.bb-elec.com or www.bb-europe.com

What is an RS-485 network? RS-485 allows multiple devices (up to 32) to communicate at half-duplex on a single pair of wires, plus a ground wire (more on that later), at distances up to 1200 meters (4000 feet). Both the length of the network and the number of nodes can easily be extended using a variety of repeater products on the market.

How does the hardware work? Data is transmitted differentially on two wires twisted together, referred to as a "twisted pair." The properties of differential signals provide high noise immunity and long distance capabilities. A 485 network can be configured two ways, "two-wire" or "four-wire." In a "two-wire" network the transmitter and receiver of each device are connected to a twisted pair. "Four-wire" networks have one master port with the transmitter connected to each of the "slave" receivers on one twisted pair. The "slave" transmitters are all connected to the "master" receiver on a second twisted pair. In either configuration, devices are addressable, allowing each node to be communicated to independently. Only one device can drive the line at a time, so drivers must be put into a high-impedance mode (tri-state) when they are not in use. Some RS-485 hardware handles this automatically. In other cases, the 485 device software must use a control line to handle the driver. (If your 485 device is controlled through an RS-232 serial port, this is typically done with the RTS handshake line.) A consequence of tri-stating the drivers is a delay between the end of a transmission and when the driver is tri-stated. This turn-around delay is an important part of a two-wire network because during that time no other transmissions can occur (not the case in a four-wire configuration). An ideal delay is the length of one character at the current baud rate (i.e. 1 ms at 9600 baud). The device manufacturer should be able to supply information on the delay for their products.

Two-wire or four-wire? Two-wire 485 networks have the advantage of lower wiring costs and the ability for nodes to talk amongst themselves. On the downside, two-wire mode is limited to half-duplex and requires attention to turn-around delay. Four-wire networks allow full-duplex operation, but are limited to master-slave situations (i.e. a "master" node requests information from individual "slave" nodes). "Slave" nodes cannot communicate with each other. Remember when ordering your cable, "two-wire" is really two wires + ground, and "four-wire" is really four wires + ground.

How does the software work? 485 software handles addressing, turn-around delay, and possibly the driver tri-state features of 485. Determine before any purchase whether your software handles these features. Remember, too much or too little turn-around delay can cause troubleshooting fits, and delay should be a function of baud rate. If you're writing your own software or using software written for an RS-232 application, be certain that provisions are made for driver tri-state control. Luckily, there are usually hardware alternatives for controlling driver tri-stating. Contact B&B Technical Support for further details.

Connecting a multidrop 485 network. The EIA RS-485 Specification labels the data wires "A" and "B", but many manufacturers label their wires "+" and "-". In our experience, the "-" wire should be connected to the "A" line, and the "+" wire to the "B" line. Reversing the polarity will not damage a 485 device, but it will not communicate. This said, the rest is easy: always connect A to A and B to B.

Signal ground, don't forget it. While a differential signal does not require a signal ground to communicate, the ground wire serves an important purpose. Over a distance of hundreds or thousands of feet there can be very significant differences in the voltage level of "ground." RS-485 networks can typically maintain correct data with a difference of -7 to +12 Volts. If the grounds differ more than that amount, data will be lost and often the port itself will be damaged. The function of the signal ground wire is to tie the signal ground of each of the nodes to one common ground. However, if the differences in signal grounds is too great, further attention is necessary. Optical isolation is the cure for this problem. Contact B&B Technical Support for more details.

RS 422/485


Introduction
The purpose of this application note is to describe the main elements of an RS-422 and RS-485 system. This application note attempts to cover enough technical details so that the system designer will have considered all the important aspects in his data system design. Since both RS-422 and RS-485 are data transmission systems that use balanced differential signals, it is appropriate to discuss both systems in the same application note. Throughout this application note the generic terms of RS-422 and RS-485 will be used to represent the EIA/TIA-422 and EIA/TIA-485 Standards.
Data Transmission Signals

Unbalanced Line Drivers
Each signal that transmits in an RS-232 unbalanced data transmission system appears on the interface connector as a voltage with reference to a signal ground. For example, the transmitted data (TD) from a DTE device appears on pin 2 with respect to pin 7 (signal ground) on a DB-25 connector. This voltage will be negative if the line is idle and alternate between that negative level and a positive level when data is sent with a magnitude of ±5 to ±15 volts. The RS-232 receiver typically operates within the voltage range of +3 to +12 and -3 to -12 volts as shown in Figure 1.1.