Understanding RS485 and RS422

Those familiar with RS232 will know that the standard defines how RS232 lines should be driven electrically: what they are called, what information they carry and even the connectors and pin numbers to use. RS422 and RS485, by contrast, define only the electrical characteristics of the driver.

Advantages of RS485 and RS422 | Differences between RS485 and RS422 | Wiring Arrangements | Preventing Voltage Reflection | Ideal RS485 Wiring | Line Pull Ups: Avoiding Serial Errors | Signal Names: Caution Required | Free RS485/RS422 Monitoring Software | Comments


Advantages of RS485 and RS422

RS485 and RS422 drive lines in a differential fashion: two wires are required for each signal. If you wish to transmit four signals then eight wires are needed. The figure below shows a single RS485 / RS422 signal being transmitted. To transmit a logic 1, line B is high and line A is low. To transmit a logic 0, line B is low and line A is high. The advantage of this arrangement is that signals can be transmitted faster and over greater distances than is possible with a single wire.

RS485 differential wiring.


Differences Between RS422 and RS485

In both RS422 and RS485, one driver can drive many receivers. In RS485 each driver can be switched off allowing multiple units to send data over a single pair of wires. This is not possible in RS422. This extra feature causes extra problems for RS485 units. Other differences are small so hereafter I will refer to units as RS485 but the remarks apply to RS422 also. Interface units often describe themselves as RS422/RS485 because a RS485 unit which is not using its extra capability is RS422 compatible.


RS485 Wiring Arrangements

When instruments are described as having an RS485 interface this tells you nothing for sure about the signals being transmitted. Usually though only the Transmit Data (TX) and Receive Data (RX) of a normal serial port are converted to RS485 or RS422. The other signals of the serial port are not used. Three arrangements are commonplace: Write only, 4-wire (full duplex) and 2-wire (half duplex).

Write Only System: Sending Data Only

In this arrangement the computer sends data out over a single RS485 pair of wires to many instruments. It never reads any data back. An example of this is the remote control of CCTV cameras. The operator can send out messages to move the camera. His feedback is the TV picture so no return data is needed. This requires only conversion of the RS232 TX signal to RS485.

Full Duplex System: Sending and Receiving Data over 4 Wires

Full Duplex means that data can pass simultaneously both to and from the instruments. This requires 4 wires - one pair to Transmit and one pair to Receive. The computer alone controls the TX transmit line. It sends out a message which includes an Address. The addressed instrument alone replies by driving the RX line.

This does mean that all the connected instruments must use the same software protocol - otherwise there will be confusion as to which instrument is being addressed. A simple conversion of RS232 to RS485 will suffice for this arrangement and no special demands are made on general purpose software such as ComDebug.

4 Wire RS485

Half Duplex System: Sending and Receiving Data over 2 Wires

Half Duplex means that data can only pass in one direction at a time. In this arrangement both TX and RX signals share a single pair of wires. This can save in installation costs.

The computer drives the lines to send out its request message but must turn its driver off to allow the instrument to reply. This is the tricky bit. Many RS232-to-RS485 converters recruit the RTS line of the serial port to switch the RS485 driver On and Off. However Windows has never made more than a half hearted attempt to support such an arrangement.

The multi-tasking nature of Windows means that it is always difficult to make actions occur at exact times - in this case there can be a significant delay between the request being sent out and the driver being switched off. If the instrument starts its reply before the switch-off then the start of the reply will be missed. Instrument manufacturers are forced to find their own solutions to this problem. This may include special software, special hardware or both.

In recent years most Serial Ports have been implemented as USB-to-Serial arrangements. These units always include a microprocessor and this can perform the task of controlling the RS485 driver very well. If you need to implement a 2-wire RS485 system you should always obtain a USB-to-RS485 converter that advertises this special feature. An example type that we use is Moxa 1130. This unit automatically switches off the driver when there is no more data to send. Such a unit can work with general purpose software such as ComDebug or HyperTerminal. Be aware though that it may not work with the special software supplied by instrument manufacturers which may assume a particular RS232- to-RS485 converter and may produce errors when used with any other unit.

2 wire RS485


Preventing Voltage Reflection

When a signal is sent down a cable there is always a reflection voltage which returns up the cable. This reflection is bigger as signals' edges get faster and lines get longer. It can be minimised by terminating the ends of the line with the characteristic impedance of the system. This is 120 ohm for RS485.


Ideal RS485 Wiring

Ideally an RS485 system consists of a single linear cable (no branches) with 120 ohm resistors connected across the 2 wires at each end of the cable.

RS485 can handle speeds of over 10 Mbits per second and line lengths of over 1 km. If you are operating anywhere near these values you must arrange your wiring close to the ideal.

For many applications where baud rates are slow (say 9600 baud), and lines are only tens of meters long, this is not essential. The wiring requirements can then be relaxed to allow cables to run in star arrangement from the computer and the terminating resistors become optional.


Line Pull Ups: Avoiding Serial Errors

In many RS485 multidrop systems there are times when no unit is driving the RS485 lines. They can then go to any voltage and may produce serial errors. To avoid this it is often necessary to fit resistors which pull one line high and the other line low putting the line into the passive state. The RS485 converters usually include such resistors which can be connected if needed.


RS485 Signal Names: Caution Required

You will find that your RS485 signal names for a line pair are either A,B or +,-. In an ideal world you would simply connect A on the computer to A on the instrument. However these names are not consistently applied by manufacturers and you may need to connect A on the computer to B on the instrument.

 


Further RS485 and RS422 Reading