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

Serial asynchronous adapter for COM port. 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

Basic concepts and terms

Almost every computer is equipped with at least one asynchronous serial adapter. Usually it is a separate board or located directly on the computer motherboard. It is also called an asynchronous RS-232-C adapter, or an RS-232-C port. Each asynchronous adapter usually contains several RS-232-C ports through which external devices can be connected to the computer. Each such port has several registers through which the program accesses it, and a specific IRQ line to signal the computer about a change in the state of the port. During the BIOS boot procedure, each RS-232-C port is assigned the logical name COM1 - COM4 (COM port number 1 - 4).

The RS-232-C interface was developed by the Electronic Industries Association (EIA) as a standard for connecting computers and various serial peripherals. The IBM PC does not fully support the RS-232-C interface; rather, the connector marked on the computer case as a serial data port contains some of the signals included in the RS-232-C interface and have voltage levels corresponding to this standard. At present, the serial communication port is widely used. Here is a far from complete list of applications:

  • mouse connection;
  • connection of plotters (plotters), scanners, printers, digitizers;
  • communication between two computers via serial data ports;
  • connection of modems for data transmission over telephone lines;
  • connection to a network of personal computers.

Basic concepts and terms

Serial data transmission means that data is transmitted over a single line. In this case, the bits of the data byte are transmitted in turn using one wire. For synchronization, a group of data bits is usually preceded by a special start bit, followed by a group of bits, followed by a parity bit and one or two stop bits. Sometimes a parity bit may be missing. This is illustrated by the following figure:

Serial asynchronous adapter for COM port

It can be seen from the figure that the initial state of the serial data line is logic level 1. This line state is called marked - MARK. When data transmission begins, the line level goes to 0. This line state is called empty - SPACE. If the line is in this state for more than a certain time, it is considered that the line has switched to the BREAK state. The start bit START signals the start of data transfer. Next, the data bits are transmitted, first the lower ones, then the higher ones.

If the parity bit P is used, then it is also transmitted. The parity bit is set so that the total number of XNUMXs (or XNUMXs) in the packet of bits is either even or odd, depending on the setting of the port's registers. This bit is used to detect errors that may occur during data transmission due to interference on the line. The receiving device recalculates the parity of the data and compares the result with the received parity bit. If the parity does not match, then it is considered that the data was transmitted with an error. Of course, such an algorithm does not give a XNUMX% guarantee of error detection. So, if an even number of bits has changed during data transmission, then the parity is preserved and the error will not be detected. Therefore, more complex error detection methods are used in practice.

At the very end, one or two stop bits STOP are transmitted, completing the transmission of the byte. Then, before the arrival of the next start bit, the line again switches to the MARK state. The use of the parity bit, start and stop bits determine the data transmission format. Obviously, the transmitter and receiver must use the same data format, otherwise the exchange will not be possible. Another important characteristic is the data transfer rate. It must also be the same for transmitter and receiver.

The data transfer rate is usually measured in baud (by the name of the French inventor of the telegraph machine Emile Baudot - E. Baudot). Bauds determine the number of bits transmitted per second. The start/stop bits as well as the parity bit are also taken into account. Sometimes another term is used - bits per second (bps). Here we mean the effective data transfer rate, excluding overhead bits.

Hardware implementation

Your computer may have one or two serial ports. These ports are located either on the motherboard or on a separate card that plugs into the expansion slots on the motherboard. There are also boards containing four or eight serial ports. They are often used to connect multiple computers or terminals to a single, central computer. These boards are called "ultiport".

The serial data port is based on the Intel 8250 chip or its modern counterparts - Intel 16450, 16550, 16550A. This chip is a universal asynchronous transceiver (UART - Universal Asynchronous Receiver Transmitter). The microcircuit contains several internal registers accessible via I/O commands. The 8250 chip contains the transmit and receive data registers. When a byte is transmitted, it is written to the transmitter's buffer register, from where it is then rewritten to the transmitter's shift register. A byte is moved out of the shift register bit by bit. Similarly, there are receiver shift and buffer registers.

The program has access only to the buffer registers, copying information to the shift registers and the shift process is performed automatically by the UART chip. The registers that control the asynchronous serial port will be described in the next chapter. The asynchronous serial port is connected to external devices through a special connector. There are two standards for RS-232-C interface connectors, they are DB25 and DB9. The first connector has 25 pins and the second has 9 pins. Here is the DB25 serial connector pinout:
Contact number Contact assignment Computer input or output
1 Protective Ground(Frame Ground, FG) -
2 Transmitted Data (TD) Log out
3 Received Data (RD) Sign In
4 Request to send (RTS) Log out
5 Clear to Send (CTS) Sign In
6 Data Set Ready (DSR) Sign In
7 Signal Ground(Signal Ground, SG) -
8 Detector received from the line signal (Data Carrier Detect, DCD) Sign In
9-19 Not used -
20 Data Terminal Ready (DTR) Log out
21 Not used -
22 Ring Indicator (RI) Sign In
23-25 Not used -

Along with the 25-pin connector, a 9-pin connector is often used:
Contact number Contact assignment Entry or exit
1 Detector received from the line signal (Data Carrier Detect, DCD) Sign In
2 Received Data (RD) Sign In
3 Transmitted Data (TD) Log out
4 Data Terminal Ready (DTR) Log out
5 Signal Ground(Signal Ground, SG) -
6 Data Set Ready (DSR) Sign In
7 Request to send (RTS) Log out
8 Clear to Send (CTS) Sign In
9 Ring Indicator (RI) Sign In

Only two pins of these connectors are used for transmitting and receiving data. The rest transmit various auxiliary and control signals. In practice, a different number of signals may be needed to connect a particular device. The RS-232-C interface defines the exchange between two types of devices: DTE (Data Terminal Equipment - terminal device) and DCE (Data Communication Equipment - communication device). In most cases, but not always, the computer is a terminal device. Modems, printers, plotters are always communication devices. Let us now consider the signals of the RS-232-C interface in more detail.

RS-232-C Interface Signals

Here we will consider the interaction between a computer and a modem, as well as two computers directly connected to each other. First, let's see how the computer connects to the modem. The TD and RD inputs are used differently by DTE and DCE devices. The DTE device uses the TD input to transmit data and the RD input to receive data. Conversely, a DCE device uses the TD input for receiving and the RD input for transmitting data. Therefore, to connect the terminal device and the communication device, the pins of their connectors must be connected directly:

Serial asynchronous adapter for COM port

The remaining lines when connecting a computer and a modem must also be connected as follows:

Serial asynchronous adapter for COM port

Consider the process of handshaking between a computer and a modem. At the beginning of a communication session, the computer must make sure that the modem can make a call (is in working order). Then, after calling the subscriber, the modem must inform the computer that it has made a connection to the remote system. In more detail, this happens as follows. The computer signals on the DTR line to indicate to the modem that it is ready to conduct a communication session. In response, the modem sends a signal on the DSR line. When the modem has made a connection to another remote modem, it sends a signal on the DCD line to inform the computer. If the voltage on the DTR line drops, this tells the modem that the computer can no longer continue the session, for example, because the computer's power is turned off. In this case, the modem will terminate the connection. If the voltage on the DCD line drops, this tells the computer that the modem has lost connection and can no longer continue the connection. In both cases, these signals give a response to the presence of communication between the modem and the computer.

We have now looked at the lowest level of communication control, the handshake. There is a higher level that is used to control the baud rate, but it is also implemented in hardware. In practice, data rate control (flow control) is necessary if large amounts of data are being transferred at high speed. When one system attempts to transmit data at a rate faster than it can be processed by the receiving system, the result can be a loss of some of the data being transmitted. To prevent the transmission of more data than can be processed, a communication control called flow control "(flow-controll handshake) is used. The RS-232-C standard defines the possibility of flow control only for a half-duplex connection. Half-duplex is a connection in which data can only be transmitted in one direction at a time, but in fact this mechanism is also used for duplex connections, when data is transmitted along the communication line simultaneously in two directions.

Flow control

On half-duplex connections, the DTE device sends an RTS signal when it wishes to send data. The DCE signals the CTS line when it is ready and the DTE begins the data transfer. Until both RTS and CTS are active, only the DCE can transmit data. For full-duplex connections, the RTS/CTS signals have the opposite meaning from those they had for half-duplex connections. When the DTE is able to receive data, it signals on the RTS line. If the DCE is also ready to receive data, it returns the CTS signal. If the voltage on the RTS or CTS lines drops, this tells the transmitting system that the receiving system is not ready to receive data. Below we give an excerpt of the dialogue between the computer and the modem that occurs during data exchange.

Serial asynchronous adapter for COM port

Of course, this all sounds good. In practice, everything is not so simple. It is not difficult to connect a computer and a modem, since the RS-232-C interface is designed just for this. But if you want to link two computers together using the same cable that you used to connect the modem and the computer, then you will have problems. To connect two terminal devices - two computers - at least a cross-connection of the TR and RD lines is required:

Serial asynchronous adapter for COM port

However, in most cases this is not enough, since for DTE and DCE devices, the functions performed by the DSR, DTR, DCD, CTS and RTS lines are asymmetric. The DTE device sends the DTR signal and waits to receive the DSR and DCD signals. In turn, the DCE device sends DSR, DCD and waits for DTR. Thus, if you connect two DTE devices together with the cable you used to connect the DTE and DCE devices, they will not be able to negotiate with each other. The handshaking process will not run.

Now let's move on to the RTS and CTS signals, flow control. Sometimes, to connect two DTE devices, these lines are connected together at each end of the cable. As a result, we get that the other device is always ready to receive data. Therefore, if the receiving device does not have time to receive and process data at a high transmission rate, data loss is possible. To solve all these problems, a special cable, colloquially called a null modem, is used to connect two DTE devices. Having two connectors and a cable, you can easily solder it yourself, guided by the following diagrams.

Serial asynchronous adapter for COM port

To complete the picture, let's consider one more aspect related to the mechanical connection of the RS-232-C ports. Due to the presence of two types of connectors - DB25 and DB9 - adapters from one type of connector to another are often needed. For example, you can use this adapter to connect a computer's COM port to a null modem cable if the computer has a DB25 connector and the cable terminates in DB9 connectors. We show a diagram of such an adapter in the following figure:

Serial asynchronous adapter for COM port

Note that many devices (such as terminals and modems) allow you to control the state of individual RS-232-C lines through internal switches (DIP-switches). These switches can change their value on different models of modems. Therefore, to use them, you should study the modem documentation. For example, for hayes-compatible modems, if switch 1 is in the "off" (down) position, this means that the modem will not check for a DTR signal. As a result, the modem can answer incoming calls even if the computer does not prompt the modem to establish a connection .

Technical parameters of RS-232-C interface

When transmitting data over long distances without the use of special equipment, due to interference induced by electromagnetic fields, errors may occur. As a result, there are restrictions on the length of the connecting cable between the DTR-DTR and DTR-DCE. The official length limit for the RS-232-C patch cable is 15,24 meters. However, in practice this distance can be much larger. It directly depends on the data transfer rate. According to McNamara (Technical Aspects of Data Communications, Digital Press, 1982) the following values ​​are defined:
Transfer rate, baudMaximum length for shielded cable, m Maximum length for unshielded cable, m
110 1524,0 914,4
300 1524,0 914,4
1200 914,4 914,4
2400 304,8 152,4
4800 304,8 76,2
9600 76,2 76,2

The voltage levels on the connector lines are -15..-3 volts for a logical zero, +3..+15 volts for a logical one. The interval from -3 to +3 volts corresponds to an undefined value. If you connect external devices to the RS-232-C interface connector (as well as when connecting two computers with a null modem), first turn off it and the computer, and also remove static charge (by connecting ground). Otherwise, you can damage the asynchronous adapter. Computer ground and external device ground must be connected together.

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

Avalanche of information 11.08.2010

According to 2008 data, the average American consumed 3600 exabytes (1 exabyte - billion gigabytes) of information per year from books, computers, television, radio, newspapers, magazines and other sources.

Since 1980, American consumption of information has increased by 5,4% annually. In many ways, however, this growth is due to the advent of modern, finely drawn computer games that display huge amounts of rapidly changing data on the monitor screen. More than half of the information Americans receive comes from computer games.

In total, US residents spend 11 hours and 48 minutes a day at a computer, watching TV, listening to music or radio programs, and (to a lesser extent) reading. The average American hears, speaks, and reads about 460 words a day (the English translation of War and Peace has about XNUMX words).

Other interesting news:

▪ Tesla will release an amphibious electric car

▪ Rest on your haunches

▪ Lights in the night sea

▪ global dimming

▪ Smartphone HTC Hero

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Cultivated and wild plants. Article selection

▪ Aristarchus article. Popular expression

▪ article Food and drink. Big encyclopedia for children and adults

▪ article The main obligations of the employer in the field of labor protection

▪ article Programmable control machine. Encyclopedia of radio electronics and electrical engineering

▪ Article Optocouplers. Part 1. 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