Linux Serial Programming detailed

Source: Internet
Author: User

Serial port itself, standard and hardware?

The serial port is the physical interface of the serial communication on the computer. Computer history, the serial port has been widely used to connect computers and terminal equipment and a variety of external devices. Although the Ethernet interface and USB interface are also transmitted as a serial stream, the serial connection is usually referred to as a hardware or modem interface that is compatible with the RS-232 standard. Although now on many personal computers, the original serial port used to connect external devices has been widely replaced by USB and FireWire, while the original serial port used to connect the network is replaced by Ethernet, and the serial device used to connect the terminal has been replaced by MDA or VGA. However, on the one hand because the serial port itself cost cheap technology mature, on the other hand because the console function of the serial port RS-232 standard highly standardized and very popular, so until now it is still widely used in various devices. Some computers use an integrated circuit called the UART as a serial device. This integrated circuit enables the conversion between a character and an asynchronous serial communication sequence, and can automatically process the timing of the data. Some low-end devices allow the CPU to transmit data directly through the output pin, a technique called bit-banging. Because the "serial port", RS-232 and UARTs basically always appear in the same context, so these nouns are usually confused. Here are some important terms and terminology explained below.

↑What is serial communication?

A computer can transmit one or more bits of data at a time. The "Serial" means transmits only one bit (1bit) of data at a time. When you need to transmit a word data through a serial communication, you can only receive or send it in one bit at a time. Each bit may be on (1) or off (0). In many technical terms, mark is often used to indicate on, while space indicates off.

The speed of serial data is usually expressed as the number of bytes transmitted per second Bits-per-second (bps) or baud rate (baud). This value represents the number of 0 and 1 sent per second. A long time ago, 300bps was fast, and now the computer can handle up to 430,800 of the RS-232 rate. The units that represent the baud rate are also KPBS and mbps,1kps=1000bps and 1mbps=1000kbps. In general, when a serial device is mentioned, it is often said that it may be a data communication device-DCE (Communications equipment) or a data terminal device-dte (the information Terminal equipment). The difference between them is very simple, each signal pair, such as transmission and reception, they are exactly the opposite. If you need to connect two DTE or DCE devices, you need an adapter or crossover cable to swap the signal pair.

↑What is RS-232?

RS-232 is an electrical interface for serial communication defined by the EIA (Electronic Industries Association). RS-232 there are actually three kinds (a, B and C) that use different voltages to represent on and off. The most widely used is rs-232c, which defines the voltage of Mark (on) as between -3v and -12v, while the voltage of space (off) is defined between +3v and +12v. Although the RS-232C standard says that the signal is transmitted at the farthest 8m, you can actually use it to transmit a longer distance until the signal baud rate is too low. The RS-232 links Remove the wires used to pass in the outgoing data, and there are wires to provide timing, state, and handshake:

RS-232 PIN Definition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.