Serial port parameters: Baud rate, data bit, stop bit, parity bit

Source: Internet
Author: User

IntroductionThe serial port is a very common protocol for device communication (not to be confused with the Universal Serial Bus Universal Serial Bus (USB)). Most computers contain two RS232-based serial ports. Serial port is also a common communication protocol for instrumentation equipment, and many GPIB-compatible devices also come with RS-232 ports. At the same time, serial communication protocol can be used to obtain data of remote acquisition device. The concept of serial communication is very simple, the serial port bitwise (BIT) Send and receive bytes. Although it is slower than parallel communication by Byte (byte), the serial port can receive data with another line while sending data using one line. It is simple and enables long-distance communication. For example, when the IEEE488 defines the parallel state of passage, the total length of the equipment line shall not exceed 20 meters, and no two devices shall be longer than 2 meters, and for the serial port, the length can be up to 1200 meters. Typically, the serial port is used for the transmission of ASCII code characters. Communication is done using 3 wires: (1) ground, (2) sent, (3) received. Because the serial communication is asynchronous, the port can send data on one line and receive data on the other line at the same time. Other lines are used to shake hands, but are not required. The most important parameters of serial communication are baud rate, data bit, stop bit, and parity check. For two ports to pass, these parameters must match:baud rateThis is a parameter that measures the symbol transfer rate. It represents the number of symbols transmitted per second. For example, 300 baud indicates that 300 symbols are sent per second. When we refer to the clock cycle, we refer to the baud rate, for example, if the protocol requires a 4800 baud rate, then the clock is 4800Hz. This means that the sampling rate of the serial communication on the data line is 4800Hz. Usually the baud rate of the telephone line is 14400,28800 and 36600. The baud rate can be much larger than these values, but the baud rate is inversely proportional to the distance. The high baud rate is often used to place very close inter-instrument communication, the typical example being the communication of a GPIB device.Data bitsThis is the parameter that measures the actual data bits in the communication. When the computer sends a packet, the actual data is not 8-bit, and the standard values are 5, 6, 7, and 8 bits. How to set up depends on the information you want to send. For example, the standard ASCII code is 0~127 (7-bit). The extended ASCII code is 0~255 (8-bit). If the data uses simple text (the standard ASCII code), then each packet uses 7 bits of data. Each package refers to a byte, which includes the start/stop bits, data bits, and parity bits. Since the actual data bit depends on the selection of the communication protocol, the term "package" refers to any communication situation.Stop BitUsed to represent the last one of a single package. Typical values are 1, 1.5, and 2 bits. Since the data is timed on the transmission line, and each device has its own clock, it is likely that there is a small difference between the two devices in the communication. So the stop bit is more than just the end of the transmission, and provides the opportunity for the computer to calibrate the clock synchronization. The more bits that apply to the stop bit, the greater the tolerance for different clock synchronizations, but the slower the data transfer rate.parity bitA simple error-checking method in serial communication. There are four methods of error detection: Occasional, odd, high and low. Of course, no check bit is also possible. For even and odd checks, the serial port sets the check bit (one after the data bit), using a value to ensure that the transmitted data has an even or odd logical high. For example, if the data is 011, for parity, the check bit is 0, and the number of bits that are logically high is an even number. If it is a parity check, the check bit is 1, so there are 3 logical highs. High and low levels are not real check data, simple bit logic high or logic low. This allows the receiving device to know the state of a bit, the opportunity to determine whether there is noise interfering with the communication or whether the transmission and reception of the data is not synchronized.2SupplementEditBit rate in the digital channel, the bitrate is the transmission rate of the digital signal, which is represented by the number of effective bits (bits) of the binary Code transmitted within a unit of time, expressed in units of bit/s (bps) per second, kilobits per second (Kbps), or megabits per second (Mbps) ( Here K and M are 1000 and 1000000 respectively, instead of 1024 and 1048576 when the computer memory capacity is involved. Baud rate baud rate index according to the signal to the carrier modulation rate, it is in the unit time the carrier modulation state changes the number of times to express, its unit is Porter (Baud). The baud rate is related to the bit rate: bit rate = baud rate x the number of bits corresponding to the individual modulation state. Obviously, the bit rate of the two-phase modulation (a single modulation state corresponds to 1 bits) is equal to the baud rate, the bit rate of the four-phase modulation (2 bits for a single modulation state) is twice times the baud rate, and the bit rate of the eight-phase modulation (3 bits for a single modulation state) is three times times the baud rate; RS232 is to be used in close range transmission on the maximum distance of 30mrs485 used in long distance transmission maximum distance 1200M

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Serial port parameters: Baud rate, data bit, stop bit, parity bit

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.