|
Articles |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Basics of the RS-232 InterfaceIn the 1960s, the Electronic Industries Association (EIA) produced recommended standard no. 232, or RS-232. This standard covered the interfacing of computer equipment and peripherals and supported the serial transfer of binary data. Both synchronous and asynchronous transfers were defined but only asynchronous (using start bits, data and stop bits) is widely used today. Data Terminal Equipment (DTE) and Data Communications Equipment (DCE)The RS-232 standard defines two types of equipment between which the transfer of data can take place: data terminal equipment (DTE) and data communications equipment (DCE). In the early days a common application for RS-232 was the remote connection of a user's terminal (DTE) via a modem (DCE) to a remote computer modem (DCE) and finally the remote computer itself (DTE). The reason a modem was used is because digital signals do not travel long distances before being distorted as a result of the electrical properties of the conducting medium. This is still true today (but we can apply technology such as adaptive channel equalisation to correct much of the distortion). Modem technology of the 1960s could only support serial data (one bit sent at a time) - this explains many of the features of RS-232 as seen today. Applications for the RS-232 interface have grown since the 1960s and today the interface is widely used with personal computers (PCs) for interfacing with such devices as printers, mouse, keyboard and modems (for Internet access, FAX and data services). Modern PCs have two serial ports fitted as standard and support peak speeds in excess of 100k bits/s. RS-232 pinoutThe "pinout" is the configuration of electrical connections used to make the interface operate. The table below lists the commonly used ones on the standard 25-way connector used on a PC: Table 1: 25-way RS-232 pinpout (as used on the modern PC)
There are numerous other connections supported by the RS-232 standard, but these are not present in modern PC systems since only asynchronous operation is possible using standard PC hardware. You may find that the serial RS-232 port on your PC has only 9 pins. This is because only the nine most popular connections (listed in table 1) are supported by PC hardware and some space can be saved on the rear panel by using a 9-way connector instead of the 25-way standard one. This means that the 9-way connection is officially 'non-standard' and will have connections that don't conform to the RS-232 standard, however, in practice the same arrangement of connection is invariably used as below: Table 2: 9-way non-standard PC RS-232 pinout
Structure of the bit streamReference has already been made to terms such as synchronous and asynchronous. Since these pages are intended to describe operation of the RS-232 in PC applications, I will stick to asynchronous operation. First to explain the terms: Synchronous. Data bits are transferred continuously using a clock signal. There is no external structure to the data stream but extra signals in addition to the data are required (as is something to synchronise the data transfer). This technique is fast since it does not require an overhead to send the data bits however it is more complex because of the need to generate accurate clocks and synchronise the data. Asynchronous. This is the mode used by PCs and divides the data into words (of 7 or 8 bits) with start and stop bits. Normally only one start bit is used but the RS-232 interface supports 1, 2 or even 1 1/2 stop bits. This technique is asynchronous because the time that each data word starts is undefined; there may also be with any sized gap between each word (or character) such as with "one-fingered" typing on a terminal's keyboard. Asynchronous operation requires serial port parameters to be specified - the baud rate, number of data bits in each word and number of stop bits. The baud rate referes to the speed with which each bit is sent and since RS-232 supports binary (high or low) only, the baud rate equals the bit rate (number of bits per second). But notice that if we were to choose one start bit, two stop bits per 7-bit word, we are sending 3 bits per word more than necessary to represent the data we want to send. However, this overhead is necessary if we do not define when transmission of the data occurs by other means. Reference is sometimes made to parity bits when using RS-232. This is a method of error checking the data being sent. Two types of parity exist: odd (where the number of 1s in the data are odd) and even (where the number of 1s in the data is even). The receiver can tell that there are errors if the parity of the data does not match the value of the parity bit which follows it (before the stop bit[s]). You can sometimes specify which type of parity to use through software and even if no parity checking is required. Not using parity is not as dangerous as it may seem since the parity check can easily be fooled by multiple errors (it cannot detect two errors which togther restore parity; an error in the data and in the parity bit itself; or combinations of several errors like this). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This document maintained by
simon.collings@cableinet.co.uk. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||