Choosing Serial I/O for Control Networks
ARTICLE BY EARLE FOSTER
(As appeared in January 2003 Electronic Products Magazine)
As the march to improve factory-floor productivity using the latest computer technology continues, the need to reliably communicate with the devices that provide low-level control and monitoring functions cannot be overlooked. The interface to these devices is commonly serial, often resulting in the need to select a suitable I/O board to expand the chosen computer system.
Choosing the I/O expansion board should not be viewed as an afterthought, since proper implementation is crucial to the operation of any data acquisition or control system. Awareness of the many hardware and software considerations will drive the selection of the correct off-the-shelf serial I/O board. In particular, choosing the correct
electrical interface, circuit protection, serial port buffer size, and software driver may ultimately determine the success of the project.
Electrical Interface Selection
The most widely used communications standard is RS-232, which is specified for operating at data rates up to 20 Kbits/s at a maximum distance of 50 ft. The actual maximum data rate may vary due to several conditions, including cable length and surrounding electrical noise.
RS-232 signals are carried as single voltages referred to a common ground, and they are best suited for office environments. A common problem encountered when implementing RS-232 in an industrial setting is data loss due to noise or ground differential. For many factory-floor applications, a more robust interface is required. The RS-422 specification offers a solution to many of the physical limitations of RS-232.
An RS-422 implementation provides a differential interface that is more immune to noise or voltage spikes that may occur on the communication line. Differential interfaces also have greater drive capability, allowing longer cable lengths.
RS-422 is rated to 10 Mbits/s and supports reliable communication to 4,000 ft. This standard also defines electrical characteristics that will allow one transmitter and up to 32 receivers on the line at once.
RS-485 is backward compatible with RS-422–offering the same noise immunity and long-distance data transmission. However, RS-485 is designed to allow multiple “talkers” and “listeners” on one twisted pair of wire.
A feature that is helpful in an RS-485-based network is hardware support for automatically enabling line drivers during character transmission and disabling them afterward–allowing a standard COM driver to be used for RS-485 communications.
If unsure whether RS-232, RS-422, or RS-485 is the best choice, or if a mixture of interfaces is required on the same multiport board, the best choice is a multi-interface serial board. These boards allow individual configuration of each port for the desired interface.
Circuit Protection
Isolation is important when equipment is connected far from the host system, or in interconnection between two or more buildings with different power sources. The difference in potential between the two locations often causes a current, or ground loop, on the ground cable.
Ground-loop-current surges can also occur when additional electrical current is introduced into the system, such as during a lightening storm. Ground loops can cause latent failure or immediate destruction of serial cards and other components.
Optical isolators eliminate spikes and surges associated with ground loops by interrupting the electrical connection with a fiber-optic link. Many serial I/O boards can be ordered with on-board optical-isolation circuits and the small extra cost is well worth the protection this option affords.
When purchasing a multiport serial card with optical isolation, make sure to choose one that isolates not only the signal lines, but also the ports from one another.
Data Buffer Size
Most off-the-shelf communications boards use standard 16C550-style UART ICs for the low-level hardware interface. A FIFO buffer built into these parts serves to collect incoming data bits until the host processor can read the information.
Many serial I/O cards still use the 16C550 or compatible 16-bit FIFO parts. Today, data acquisition and control applications are frequently running under nondeterministic operating systems like Windows.
The result can be buffer overflow in a serial application not being serviced quickly enough. Buffer overflow is often the culprit in intermittent serial communication problems and can be difficult to diagnose and correct.
Newer UARTs use larger buffers. A 128-byte 16C850 UART not only provides eight times the buffer capacity of the 16C550, but is also completely backward compatible with existing software.
Software Driver Support
Software support for serial I/O boards should obviously provide drivers for the make and version of the operating system used by the application. Other features will make implementation easier, including utilities that allow COM port number changes and port assignment as well as individual data-rate selection for each port.
Additional diagnostic features will also prove useful. Control over the default UART parameters and modem control signals will prove helpful during initial setup and installation, as will diagnostic applications such as loopback tests, bit-error-rate testing, and throughput monitoring.