Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

RS-232C interface. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Computers

Comments on the article Comments on the article

The RS-232C interface is designed to connect equipment that transmits or receives data (DTE - data terminal equipment, or ADF - data transmission equipment; DTE - Data Terminal Equipment) to the terminal equipment of data channels (DCE; DCE - Data Communication Equipment). The role of the ADF can be a computer, printer, plotter and other peripheral equipment. The modem usually acts as the DCE. The ultimate purpose of a connection is to connect two ADFs. The complete connection diagram is shown in fig. one; The interface allows you to eliminate the remote communication channel along with a pair of DCE devices by connecting the devices directly using a null modem cable (Fig. 1).

Complete scheme RS-232C interface. RS-232C connections
Rice. 1. Complete RS-232C connection diagram

RS-232C interface. RS-232C connection with null modem cable
Rice. 2. RS-232C connection with null modem cable

The standard describes interface control signals, data transfer, electrical interface and connector types. The standard provides for asynchronous and synchronous communication modes, but COM ports only support asynchronous mode. Functionally, RS-232C is equivalent to CCITT V.24/V.28 and C2 interface, but they have different signal names.

The RS-232C standard describes unbalanced transmitters and receivers - the signal is transmitted relative to a common wire - circuit ground (balanced differential signals are used in other interfaces - for example, RS-422). The interface does not provide galvanic isolation of devices. The logical one (MARK state) at the data input (RxD signal) corresponds to the voltage range from -12 to -3 V; logic zero - from +3 to +12 V (SPACE state). For control signal inputs, the ON state ("on") corresponds to the range from +3 to +12 V, the OFF state ("off") - from -12 to -3 V. The range from -3 to +3 V is the dead zone, which determines receiver hysteresis: the line state will be considered changed only after crossing the threshold (Fig. 3). The signal levels at the outputs of the transmitters must be in the ranges from -12 to -5 V and from +5 to +12 V. The potential difference between the circuit grounds (SG) of the connected devices must be less than 2 V, with a higher potential difference, incorrect perception of signals is possible . Note that TTL level signals (at the inputs and outputs of UART chips) are transmitted in direct code for the TxD and RxD lines and in inverse code for all the others.

The interface assumes a protective earth connection for the connected devices if they are both powered by AC power and have line filters.

Attention!

Connection and disconnection of interface cables of self-powered devices must be carried out with the power off. Otherwise, the difference in unbalanced device potentials at the time of switching may be applied to the output or input (which is more dangerous) interface circuits and disable the microcircuits.

The RS-232C standard regulates the types of connectors used.

On ADF equipment (including COM ports), it is customary to install DB-25P plugs or a more compact version - DB-9P. Nine-pin connectors do not have pins for the additional signals required for synchronous mode (most 25-pin connectors do not use these pins).

DB-25S or DB-9S sockets are installed on AKD equipment (modems).

This rule assumes that AKD connectors can be connected to ADF connectors directly or via "straight" female and male adapter cables with pins connected one to one. Adapter cables can also be adapters from 9 to 25-pin connectors (Fig. 4).

If the ADF equipment is connected without modems, then the device connectors (plugs) are connected to each other by a null-modem cable (Zero-modem, or Z-modem), which has sockets at both ends, the contacts of which are connected crosswise according to one of the diagrams shown in Fig. 5.

RS-232C interface. Receiving RS-232C Signals
Rice. 3. Receiving RS-232C signals

RS-232C interface. Modem cables
Rice. 4. Modem cables

RS-232C interface. Null modem cable
Rice. 5. Null-modem cable: a - minimum, b - full

If an outlet is installed on any ADF device, it is almost 100% that it must be connected to another device with a direct cable, similar to a modem connection cable. The socket is usually installed on those devices that do not have a remote connection via a modem.

In table. 1 shows the pin assignment of the COM ports (and any other ADF data transmission equipment). The pins of the DB-25S connector are defined by the EIA/TIA-232-E standard, the DB-9S connector is defined by the EIA/TIA-574 standard. Modems (AKD) have the same name of circuits and contacts, but the roles of signals (input-output) are reversed.

Table 1. Connectors and signals of the RS-232C interface
Chain designation connector pin Wire No. of remote connector cable PC Direction
COM- RS- V.24 db- db- 11 22 33 44 I / O
port 232 Joint 2 25P 9P          
PG AA 101 1 5 (10) (10) (10) 1 -
SG AB 102 7 5 5 9 1 13 -
td BA 103 2 3 3 5 3 3 O
RD BB 104 3 2 2 3 4 5 I
RTS CA 105 4 7 7 4 8 7 O
CTS CB 106 5 8 8 6 7 9 I
DSR CC 107 6 6 6 2 9 11 I
dtr CD 108/2 20 4 4 7 2 14 O
DCD CF 109 8 1 1 1 5 15 I
RI CE 125 22 9 9 8 6 18 I

1 8-bit multicard ribbon cable.

2 Ribbon cable for 16-bit multicards and ports on motherboards.

3 Ribbon cable option for ports on motherboards.

4 Wide ribbon cable to 25-pin connector.

The subset of RS-232C signals related to the asynchronous mode will be considered from the point of view of the PC COM port. For convenience, we will use the mnemonic names adopted in the descriptions of COM ports and most devices (it differs from the faceless RS-232 and V.24 designations). Recall that the active state of the control signals ("on") and the zero value of the transmitted data bit correspond to a positive potential (above +3 V) of the interface signal, and the "off" state and a single bit correspond to a negative potential (below -3 V). The purpose of the interface signals is given in Table. 2. The normal sequence of control signals for the case of connecting a modem to a COM port is illustrated in fig. 6.

Table 2. Purpose of RS-232C interface signals
Signal appointment
PG Protected Ground - protective earth, connected to the device case and cable screen
SG Signal Ground - signal (circuit) ground, relative to which signal levels act
td Transmit Data - serial data - transmitter output
RD Receive Data - serial data - receiver input
RTS Request To Send - data transfer request output: the "on" state notifies the modem that the terminal has data to send. In half-duplex mode, it is used for direction control - the "on" state signals the modem to switch to transmit mode
CTS Clear To Send - input allowing the terminal to send data. The "off" state disables data transfer. The signal is used for hardware flow control
DSR Data Set Ready - ready signal input from the data transmission equipment (the modem is connected to the channel in the operating mode and has completed the coordination with the equipment at the opposite end of the channel)
dtr Data Terminal Ready - terminal readiness signal output for data exchange. The "on" state keeps the dial-up link in a connected state
DCD Data Carrier Detected - remote modem carrier detection signal input
RI Ring Indicator - call indicator input. In a switched channel, the modem signals the acceptance of a call with this signal.

RS-232C interface. Interface Control Sequence
Rice. 6. Sequence of interface control signals

  1. By setting DTR, the computer indicates a desire to use the modem.
  2. By setting DSR, the modem signals its readiness and connection establishment.
  3. With the RTS signal, the computer requests permission to transmit and declares its readiness to receive data from the modem.
  4. With the CTS signal, the modem notifies that it is ready to receive data from the computer and transfer them to the line.
  5. By removing the CTS, the modem signals the impossibility of further reception (for example, the buffer is full) - the computer must suspend data transmission.
  6. With the CTS signal, the modem allows the computer to continue transmitting (there is room in the buffer).
  7. Removing the RTS can mean both the computer buffer is full (the modem must stop transmitting data to the computer), or the lack of data to transmit to the modem. Usually in this case, the modem stops sending data to the computer.
  8. The modem acknowledges the removal of the RTS by resetting the CTS.
  9. The computer resets RTS to resume transmission.
  10. The modem confirms its readiness for these actions.
  11. The computer indicates the completion of the exchange.
  12. The modem acknowledges.
  13. The computer removes DTR, which is usually a signal to disconnect ("hang up").
  14. By resetting the DSR, the modem signals a disconnection.

From this sequence, the DTR-DSR and RTS-CTS connections on null modem cables become clear.

Asynchronous transfer mode

The asynchronous transfer mode is byte-oriented (character-oriented): the minimum unit of information sent is one byte (one character). The byte sending format is illustrated in Fig. 7. The transmission of each byte begins with a start bit, signaling the receiver to start sending, followed by data bits and possibly a parity bit. Ends the send with a stop bit, which guarantees a pause between sends. The start bit of the next byte is sent at any time after the stop bit, that is, pauses of arbitrary duration are possible between transmissions. The start bit, which always has a strictly defined value (logical 0), provides a simple mechanism for synchronizing the receiver with a signal from the transmitter. The receiver and transmitter are assumed to operate at the same baud rate. The receiver's internal clock generator uses a reference frequency divider counter that is reset to zero when the start bit is received. This counter generates internal strobes by which the receiver fixes subsequent received bits. Ideally, the strobes are located in the middle of the bit intervals, which allows you to receive data even with a slight mismatch in the speeds of the receiver and transmitter. Obviously, when transmitting 8 data bits, one control bit and one stop bit, the maximum allowable rate mismatch at which the data will be recognized correctly cannot exceed 5%. Taking into account phase distortions and the discreteness of the operation of the internal synchronization counter, a smaller frequency deviation is actually acceptable. The smaller the division ratio of the reference frequency of the internal oscillator (the higher the transmission frequency), the greater the error of strobe binding to the middle of the bit interval, and the requirements for frequency consistency become more stringent. The higher the transmission frequency, the greater the effect of edge distortion on the phase of the received signal. The interaction of these factors leads to an increase in the requirements for the consistency of the frequencies of the receiver and transmitter with an increase in the exchange frequency.

RS-232C interface. RS-232C asynchronous transmission format
Rice. 7. RS-232C asynchronous transmission format

The asynchronous send format allows you to detect possible transmission errors.

The asynchronous send format allows you to detect possible transmission errors.

  • If a transition signaling the start of a transmission is received, and the start-bit strobe is set to a logical one level, the start-bit is considered false and the receiver goes back to the waiting state. The receiver may not report this error.
  • If a logical zero level is detected during the time allotted for the stop bit, a stop bit error is recorded.
  • If parity is used, then after sending the data bits, a parity bit is transmitted. This bit pads the number of XNUMX data bits to an even or odd number depending on the convention. Reception of a byte with an invalid value of the control bit leads to fixing the error.
  • Format control allows you to detect a line break: as a rule, when a break occurs, the receiver "sees" a logical zero, which is first interpreted as a start bit and zero data bits, but then the stop bit control is triggered.

For asynchronous mode, a number of standard exchange rates have been adopted: 50, 75, 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bps. Sometimes "baud" (baud) is used instead of the unit of measure "bps", but this is incorrect when considering binary transmitted signals. In bauds, it is customary to measure the frequency of line state changes, and with a non-binary coding method (widely used in modern modems), the bit rate (bps) and signal changes (baud) in the communication channel can differ several times.

The number of data bits can be 5, 6, 7 or 8 (5- and 6-bit formats are not widely used). The number of stop bits can be 1, 1,5 or 2 ("one and a half bits" means only the duration of the stop interval).

Data flow control

To control the flow of data (Flow Control), two protocol options can be used - hardware and software. Flow control is sometimes confused with handshaking. Handshaking involves sending a notification that an element has been received, while flow control involves sending a notification about the possibility or impossibility of receiving data later. Flow control is often based on a handshaking mechanism.

The hardware flow control protocol RTS/CTS (hardware flow control) uses the CTS signal, which allows you to stop the transfer of data if the receiver is not ready to receive them (Fig. 8). The transmitter "releases" the next byte only when the CTS line is on. A byte that has already begun to be transmitted cannot be delayed by the CTS signal (this guarantees the integrity of the message). The hardware protocol provides the fastest response of the transmitter to the state of the receiver. Chips of asynchronous transceivers have at least two registers in the receiving part - shift, for receiving the next message, and storage, from which the received byte is read. This allows you to implement an exchange using a hardware protocol without data loss.

RS-232C interface. Hardware flow control
Rice. 8. Hardware flow control

The hardware protocol is convenient to use when connecting printers and plotters, if they support it. When connecting two computers directly (without modems), the hardware protocol requires a cross-connection of the RTS - CTS lines.

With a direct connection, the transmitting terminal must be provided with the "on" state on the CTS line (by connecting its own RTS - CTS lines), otherwise the transmitter will be "silent".

The 8250/16450/16550 transceivers used in the IBM PC do not process the CTS signal in hardware, but only show its state in the MSR register. The implementation of the RTS/CTS protocol is assigned to the BIOS Int 14h driver, and it is not entirely correct to call it "hardware". If the program using the COM port interacts with the UART at the register level (and not through the BIOS), then it handles the processing of the CTS signal to support this protocol itself. A number of communication programs allow you to ignore the CTS signal (unless a modem is used), and they do not need to connect the CTS input to the output of even their own RTS signal. However, there are other transceivers (for example, 8251) in which the CTS signal is processed by hardware. For them, as well as for "honest" programs, the use of the CTS signal on connectors (and even on cables) is mandatory.

The XON/XOFF flow control software protocol assumes the presence of a bidirectional data channel. The protocol works as follows: if the device that receives data detects reasons why it can no longer receive it, it sends the XOFF (13h) byte character over the reverse serial channel. The opposite device, having received this character, suspends transmission. When the receiving device becomes ready to receive data again, it sends an XON character (11h), upon receipt of which the opposite device resumes transmission. The response time of the transmitter to a change in the state of the receiver, compared to the hardware protocol, increases by at least the time of transmitting a character (XON or XOFF) plus the response time of the transmitter program to receiving a character (Fig. 9). It follows from this that lossless data can only be received by a receiver that has an additional received data buffer and signals unavailability in advance (having free space in the buffer).

RS-232C interface. XON/XOFF software flow control
Rice. 9. XON/XOFF software flow control

The advantage of the software protocol is that there is no need to transmit interface control signals - the minimum cable for two-way exchange can have only 3 wires (see Fig. 5, a). The disadvantage, in addition to the mandatory presence of a buffer and a longer response time (reducing the overall performance of the channel due to waiting for the XON signal), is the complexity of implementing a full duplex exchange mode. In this case, flow control characters must be extracted (and processed) from the stream of received data, which limits the set of transmitted characters.

In addition to these two common standard protocols supported by both the PU and the OS, there are others.

Publication: cxem.net

See other articles Section Computers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Artificial leather for touch emulation 15.04.2024

In a modern technology world where distance is becoming increasingly commonplace, maintaining connection and a sense of closeness is important. Recent developments in artificial skin by German scientists from Saarland University represent a new era in virtual interactions. German researchers from Saarland University have developed ultra-thin films that can transmit the sensation of touch over a distance. This cutting-edge technology provides new opportunities for virtual communication, especially for those who find themselves far from their loved ones. The ultra-thin films developed by the researchers, just 50 micrometers thick, can be integrated into textiles and worn like a second skin. These films act as sensors that recognize tactile signals from mom or dad, and as actuators that transmit these movements to the baby. Parents' touch to the fabric activates sensors that react to pressure and deform the ultra-thin film. This ... >>

Petgugu Global cat litter 15.04.2024

Taking care of pets can often be a challenge, especially when it comes to keeping your home clean. A new interesting solution from the Petgugu Global startup has been presented, which will make life easier for cat owners and help them keep their home perfectly clean and tidy. Startup Petgugu Global has unveiled a unique cat toilet that can automatically flush feces, keeping your home clean and fresh. This innovative device is equipped with various smart sensors that monitor your pet's toilet activity and activate to automatically clean after use. The device connects to the sewer system and ensures efficient waste removal without the need for intervention from the owner. Additionally, the toilet has a large flushable storage capacity, making it ideal for multi-cat households. The Petgugu cat litter bowl is designed for use with water-soluble litters and offers a range of additional ... >>

The attractiveness of caring men 14.04.2024

The stereotype that women prefer "bad boys" has long been widespread. However, recent research conducted by British scientists from Monash University offers a new perspective on this issue. They looked at how women responded to men's emotional responsibility and willingness to help others. The study's findings could change our understanding of what makes men attractive to women. A study conducted by scientists from Monash University leads to new findings about men's attractiveness to women. In the experiment, women were shown photographs of men with brief stories about their behavior in various situations, including their reaction to an encounter with a homeless person. Some of the men ignored the homeless man, while others helped him, such as buying him food. A study found that men who showed empathy and kindness were more attractive to women compared to men who showed empathy and kindness. ... >>

Random news from the Archive

The laser puts nanodots 08.02.2005

American scientists have come up with a new technology for mass production of quantum dots.

A quantum dot is good because it is able to re-emit the absorbed light, and its wavelength strictly depends on the size of the dot. However, until now, scientists are not very good at either obtaining exactly the same nanodots or arranging them in a strict order and are constantly looking for new techniques.

For example, scientists from the University of Missouri Rola (USA), led by Dr. Massimo Berti, offer such a method. Two components are mixed in silica gel - cadmium nitrate and thiourea.

At room temperature, these substances react, forming particles of a semiconductor substance, cadmium sulfide. To slow down the reaction, the gel is immediately cooled. Then an infrared laser beam passes over the gel; it heats up the smallest, micron-sized areas of the surface, and there a reaction begins, which gives nanometer particles of cadmium sulfide. These are the nanodots, and they are lined up in a strict order - the way the laser beam went.

Scientists have not stopped there and are now looking for ways to shine with an ultraviolet laser, as well as work with honeycomb structures in which holes a couple of nanometers in diameter are ordered.

Other interesting news:

▪ Robots LG CLOi will support small patients

▪ Poplars will learn to decompose poisons

▪ Infineon unveils world's smallest GPS receiver

▪ A safe and inexpensive way to launch small satellites

▪ Blood vessels are easier to print

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the Garland website. Article selection

▪ article by Sappho. Famous aphorisms

▪ article Which science was an exception to Socratic I know that I know nothing? Detailed answer

▪ article Kopeck pea. Legends, cultivation, methods of application

▪ article Voltage swing indicator. Encyclopedia of radio electronics and electrical engineering

▪ article Measurements of electrical quantities. Frequency measurement. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024