Here we examine the history of the 3 serial interfaces used today and explore the common issues found with them and the benefits of each of the 3 different connections.
RS232: Down but not out
Once a standard feature on personal computers, the RS232 serial port was one of the first used to connect data terminals to mainframe computers. It remained in widespread use for serial communications between PCs, printers and other peripherals until the late 1990’s, after which it was superseded by USB. However, RS232 ports remain in use today in the industrial sector.
RS232 Connection and Configuration
Connecting a RS232 port to a laptop usually requires a RS232 to USB converter like our Define Multicom. Typically they are used as programming ports to configure instruments and controllers, and are also used in SCADA (Supervisory Control and Data Acquisition) systems. SCADA systems gather data from RTU’s (Remote Terminal Units) like controllers or meters, and then display the results on a PC. Here, RS232 ports are used for several reasons:
- There are many reported problems with RS485 cards.
Instabilities caused by the Windows operating system controlling the flow of data leads to unreliability across many SCADA programs. To get around this, SCADA systems prefer an RS232 card (which does not have any flow issues) coupled with an external RS485 to RS232 converter like the Multicom.
- RS232 cards are more readily available than RS485 cards.
Another common application for an RS232 port is in small printer applications. Typically an instrument like a panel meter can drive a printer to print items such as weigh bridge dockets or to drive a cell phone modem.
Issues with RS232
- Connect what to what?
- There are three pins used for signaling on a RS232 system:
- Rx – Receiver
- Tx – Transmitter
- Gnd – Signal ground
(There are other signals in the specification used for hardware handshaking such as RTS and DTR, but these are not used in Define Instruments products.)
The original standard makes a distinction between a computer (master device) known as DTE (Data Transmission Equipment) and a slave device known as DCE (or Data Communications Equipment). The labeling of the DCE becomes an issue, in that the Rx of the computer must be connected to the Tx of the DCE, and vice versa. As many instruments now can act as both master and slave (e.g. driving a printer), this leaves the quandary of how to label the device: DTE or DCE?
Over the years, manufacturers have not shown consistency on this point. This has been further complicated by manufacturers of devices that are limited by their size opting to not use the official connectors of the standard (as they are too bulky). As a result, the system cannot be identified from the connector as DTE or DCE. Thus one is left without knowing which way to connect: Rx from the device to the Rx of the computer, or the Tx of the computer to the Tx line on the device. Employing trial and error is all that remains.
Fortunately, incorrect connection of the pins is not damaging. If wrongly connected, the driver chips simply won’t work. Cross over cables are so named as they perform the cross over in the cable, and are a very handy addition to a technician’s toolkit.
- Caution is required when grounding the RS232 signal
- Most desktop computers ground of the RS232 ports are internally connected to earth. This presents problems if the DCE’s serial port is not isolated from all other signals.
For example: a DCE serial port ground maybe referenced to another signal in a system which is not grounded. Connecting the grounds together in this case will short points together which are at different potentials, and more than likely cause damage to the PC or device.
To get around this, the device’s serial port must be verified as a fully isolated design. All Define Instruments RS232 ports are fully isolated. If the port is not isolated, then one must use an external device that isolates the serial ports. (The Define Multicom can be used to galvanically isolate two RS232 ports.)
- Variable protocols
- The RS232/RS485/RS422 standards only relate to the hardware interface, not the software protocol required to make the buses communicate. There are numerous protocols (both open standards and proprietary) that exist in the market place. Hence one cannot assume interoperability between different manufacturers of “RS232” ports.
Define Instruments supports a mixture of industry standard and proprietary protocols:
- Modbus RTU
This protocol is widely used in industry and most SCADA packages and PLC’s have drivers for it. However a word of warning using Modbus: although the Modbus protocol is well published, every manufacturer can and does determine its own addressing scheme. This means the manufacturer must supply the addressing scheme, register type, and Modbus commands supported, for successful integration into a Modbus system.
- ASCII protocol
The reason ASCII is popular is that it is easier than Modbus to write your own driver in a PLC or a PC. Define has its own protocol based on ASCII characters. Again, every manufacturer’s protocols – although similar – are not usually compatible.
- String outputs
Define supports two streaming string outputs. In these modes every new sample is streamed out in ASCII to the serial port. A computer on the other end can easily disseminate the reading in between start and stop characters. This type of output is very popular in the weighing industry as it is used to drive computers, large displays and summing units.
- Modbus RTU
RS485: Still popular
The RS485 port has been used successfully for many years, and while RS232 installations are in decline, the RS485’s popularity shows no signs of abating.
The RS485 has many advantages over both RS232 and USB when it comes to applications in noisy industrial environments. It was designed from the beginning to be tolerant of noise and forgiving of long cable runs. It achieves this by using a differential current drive output which has high immunity to noise.
While RS232 installations are in decline, the RS485’s popularity shows no signs of abating.
Another major advantage is that users can have more than one slave on the BUS. The original specification stated a maximum of 32 slaves, due to the leakage of the then driver chips. These days the chips have improved, and many can support up to 256 slave devices.
The slave units are simply wired in a daisy chain configuration, meaning one port can talk to 256 slaves. This is great for large SCADA systems and comes at a very low cost to implement.
Issues with RS485
- Timing of the controlling BUS
- The RS485 signaling system uses two wires to achieve its drive: A+ and A- sometimes referred to as A and B, or D+ and D-. These two signals, along with a ground signal for reference, become the BUS. To achieve bi-directional communications like most protocols require, the BUS is shared between transmitting and receiving. So when one end of the BUS is transmitting it must take control, and the other end must release control and enter a listening mode.
The timing of controlling the BUS is critical for a successful installation. If the transmitting side takes too long to release the BUS, the other side may start transmitting before the first has finished, causing the message to be corrupted.
Many computer RS485 cards use the RTS signal in a standard PC UART to control the BUS. Unfortunately Windows then has to control this signal. Since Windows is not a Real Time Operating System (RTOS), the signal may be delayed (for a multitude of other operating system demands), resulting in garbled messages.
The best way to eliminate this issue is to use an external RS485 to RS232, or RS485 to USB converter, like the Define Multicom. Embedded devices like the Multicom take care of this issue.
- Misconceptions around the necessity of the ground connection
- A common misconception is that only the two signaling wires are required for a RS485 system and the ground connection can be omitted. This is incorrect. Even though the system may appear to work without the ground, its noise rejection and reliability is significantly degraded.
- When to use RS485 terminating resistors
- The RS485 standard is designed to work up to 10Mbits/s, while most industrial systems tend to work up to 115Kbits/s max (or a 100th of the maximum).
Terminating resistors are required if using very high baud rates, as transmission line reflections from un-terminated ends can come back to be read mistakenly as a valid signals. A good rule of thumb is if the system runs up to 115K, one need not worry about terminating resistors.
- Labeling of the terminals
- The standard shows A and B. Unfortunately, early in the RS485’s history, a semiconductor maker mislabeled these pins on a RS485 driver IC datasheet. This caused mass confusion for manufacturers who referenced this datasheet and incorrectly transposed the pin labels. Some manufacturers noticed the error and amended their labeling.
The consequence of this is that there are many products which have incompatible labeling. The solution is to swap the wiring around (the same workaround as for the RS232). Define labels all its products as D+, D- and Sgnd. For wiring a system together, simply connect all D+ together as with D- and Sgnd.
RS422: In decline
The RS422 port was the predecessor to the RS485 port and is becoming less and less common today. The main difference is that the RS422 port has separate drivers for Transmit and Receive. Hence instead of 3 wires, 5 wires are required for a RS422 bus. Many of the same advantages of the RS485 BUS are retained in the RS422 BUS.
This paper gives a bit of history of the three different serial interfaces commonly used today. It explains common issues found in setting up such a system and the benefits of the three different connections. Although both the RS232 and RS422 connections are in decline today, the many benefits of the RS485 connection will ensure that it will remain relevant for many years to come.
The many benefits of the RS485 connection ensure that it will remain relevant for many years to come.