Home      Discussion      Topics      Dictionary      Almanac
Signup       Login
Serial port

Serial port

Overview

Discussion
Ask a question about 'Serial port'
Start a new discussion about 'Serial port'
Answer questions from other users
Full Discussion Forum
 
Unanswered Questions
Recent Discussions
Encyclopedia

In computing
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...

, a serial port is a serial communication
Serial communication
In telecommunication and computer science, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels...

 physical interface through which information transfers in or out one bit
Bit
A bit is the basic unit of information in computing and telecommunications; it is the amount of information stored by a digital device or other physical system that exists in one of two possible distinct states...

 at a time (in contrast to a parallel port
Parallel port
A parallel port is a type of interface found on computers for connecting various peripherals. In computing, a parallel port is a parallel communication physical interface. It is also known as a printer port or Centronics port...

). Throughout most of the history of personal computer
Personal computer
A personal computer is any general-purpose computer whose size, capabilities, and original sales price make it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator...

s, data transfer through serial ports connected the computer to devices such as terminal
Computer terminal
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system...

s and various peripherals.

While such interfaces as Ethernet
Ethernet
Ethernet is a family of computer networking technologies for local area networks commercially introduced in 1980. Standardized in IEEE 802.3, Ethernet has largely replaced competing wired LAN technologies....

, FireWire, and USB
Universal Serial Bus
USB is an industry standard developed in the mid-1990s that defines the cables, connectors and protocols used in a bus for connection, communication and power supply between computers and electronic devices....

 all send data as a serial stream, the term "serial port" usually identifies hardware more or less compliant to the RS-232
RS-232
In telecommunications, RS-232 is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between a DTE and a DCE . It is commonly used in computer serial ports...

 standard, intended to interface with a modem
Modem
A modem is a device that modulates an analog carrier signal to encode digital information, and also demodulates such a carrier signal to decode the transmitted information. The goal is to produce a signal that can be transmitted easily and decoded to reproduce the original digital data...

 or with a similar communication device.

Modern computers without serial ports may require serial-to-USB converters to allow compatibility with RS 232 serial devices. Serial ports are still used in applications such as industrial automation systems, scientific instruments, shop till
Cash register
A cash register or till is a mechanical or electronic device for calculating and recording sales transactions, and an attached cash drawer for storing cash...

 systems and some industrial and consumer products. Server
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...

 computers may use a serial port as a control console for diagnostics. Network equipment (such as routers and switches) often use serial console for configuration. Serial ports are still used in these areas as they are simple, cheap and their console functions are highly standardized and widespread. A serial port requires very little supporting software from the host system.

Hardware



Some computers, such as the IBM PC
IBM PC
The IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...

, used an integrated circuit
Integrated circuit
An integrated circuit or monolithic integrated circuit is an electronic circuit manufactured by the patterned diffusion of trace elements into the surface of a thin substrate of semiconductor material...

  called a UART, that converted characters to (and from) asynchronous serial form, and automatically looked after the timing and framing of data. Very low-cost systems, such as some early home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a single nontechnical user...

s, would instead use the CPU
Central processing unit
The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...

 to send the data through an output
Input/output
In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...

 pin, using the so-called bit-banging
Bit-banging
Bit banging is a technique for serial communications using software instead of dedicated hardware. Software directly sets and samples the state of pins on the microcontroller, and is responsible for all parameters of the signal: timing, levels, synchronization, etc...

 technique. Before large-scale integration (LSI) UART integrated circuits were common, a minicomputer
Minicomputer
A minicomputer is a class of multi-user computers that lies in the middle range of the computing spectrum, in between the largest multi-user systems and the smallest single-user systems...

 or microcomputer
Microcomputer
A microcomputer is a computer with a microprocessor as its central processing unit. They are physically small compared to mainframe and minicomputers...

 would have a serial port made of multiple small-scale integrated circuits to implement shift registers, logic gates, counters, and all the other logic for a serial port.

Early home computers often had proprietary serial ports with pinouts and voltage levels incompatible with RS-232. Inter-operation with RS-232 devices may be impossible as the serial port cannot withstand the voltage levels produced and may have other differences that "lock in
Vendor lock-in
In economics, vendor lock-in, also known as proprietary lock-in or customer lock-in, makes a customer dependent on a vendor for products and services, unable to use another vendor without substantial switching costs...

" the user to products of a particular manufacturer.

Low-cost processors now allow higher-speed, but more complex, serial communication standards such as USB
Universal Serial Bus
USB is an industry standard developed in the mid-1990s that defines the cables, connectors and protocols used in a bus for connection, communication and power supply between computers and electronic devices....

 and FireWire to replace RS-232. These make it possible to connect devices that would not have operated feasibly over slower serial connections, such as mass storage, sound, and video devices.

Many personal computer motherboards still have at least one serial port, even if accessible only through a pin header. Small-form-factor systems and laptops may omit RS-232 connector ports to conserve space, but the electronics are still there. RS-232 has been standard for so long that the circuits needed to control a serial port became very cheap and often exist on a single chip, sometimes also with circuitry for a parallel port.

Connectors


While the RS-232 standard originally specified a 25-pin D-type
D-subminiature
The D-subminiature or D-sub is a common type of electrical connector. They are named for their characteristic D-shaped metal shield. When they were introduced, D-subs were among the smaller connectors used on computer systems....

 connector, many designers of personal computers chose to implement only a subset of the full standard: they traded off compatibility with the standard against the use of less costly and more compact connectors (in particular the DE-9 version used by the original IBM PC-AT). The desire to supply serial interface cards with two ports required that IBM reduce the size of the connector to fit onto a single card back panel. A DE-9 connector also fits onto a card with a second DB-25 connector that was similarly changed from the original Centronics-style
Parallel port
A parallel port is a type of interface found on computers for connecting various peripherals. In computing, a parallel port is a parallel communication physical interface. It is also known as a printer port or Centronics port...

 connector. Starting around the time of the introduction of the IBM PC-AT, serial ports were commonly built with a 9-pin connector to save cost and space. However, presence of a 9-pin D-subminiature connector is neither necessary nor sufficient to indicate use of a serial port, since this connector was also used for video, joysticks, and other purposes.

Some miniaturized electronics, particularly graphing calculator
Graphing calculator
A graphing calculator typically refers to a class of handheld calculators that are capable of plotting graphs, solving simultaneous equations, and performing numerous other tasks with variables...

s and hand-held amateur
Amateur radio
Amateur radio is the use of designated radio frequency spectrum for purposes of private recreation, non-commercial exchange of messages, wireless experimentation, self-training, and emergency communication...

 and two-way radio
Two-way radio
A two-way radio is a radio that can both transmit and receive , unlike a broadcast receiver which only receives content. The term refers to a personal radio transceiver that allows the operator to have a two-way conversation with other similar radios operating on the same radio frequency...

 equipment, have serial ports using a jack plug connector, usually the smaller 2.5 or 3.5 mm connectors and use the most basic 3-wire interface.

Many models of Macintosh
Macintosh
The Macintosh , or Mac, is a series of several lines of personal computers designed, developed, and marketed by Apple Inc. The first Macintosh was introduced by Apple's then-chairman Steve Jobs on January 24, 1984; it was the first commercially successful personal computer to feature a mouse and a...

 favored the related RS-422 standard, mostly using German Mini-DIN connector
Mini-DIN connector
The mini-DIN connectors are a family of multi-pin electrical connectors used in a variety of applications. Mini-DIN is similar to the larger, older DIN connector...

s, except in the earliest models. The Macintosh included a standard set of two ports for connection to a printer and a modem, but some PowerBook
PowerBook
The PowerBook was a line of Macintosh laptop computers that was designed, manufactured and sold by Apple Computer, Inc. from 1991 to 2006. During its lifetime, the PowerBook went through several major revisions and redesigns, often being the first to incorporate features that would later become...

 laptops had only one combined port to save space.

The standard specifies 20 different signal connections. Since most devices use only a few signals, smaller connectors can often be used. For example, the 9 pin DE-9
D-subminiature
The D-subminiature or D-sub is a common type of electrical connector. They are named for their characteristic D-shaped metal shield. When they were introduced, D-subs were among the smaller connectors used on computer systems....

 connector was used by most IBM-compatible PCs since the IBM PC AT, and has been standardized as TIA-574. More recently, modular connectors
Registered jack
A registered jack is a standardized physical network interface — both jack construction and wiring pattern — for connecting telecommunications or data equipment to a service provided by a local exchange carrier or long distance carrier. The standard designs for these connectors and their wiring...

 have been used. Most common are 8P8C connectors. Standard EIA/TIA 561 specifies a pin assignment, but the "Yost Serial Device Wiring Standard"
invented by Dave Yost (and popularized by the Unix System Administration Handbook) is common on Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 computers and newer devices from Cisco Systems
Cisco Systems
Cisco Systems, Inc. is an American multinational corporation headquartered in San Jose, California, United States, that designs and sells consumer electronics, networking, voice, and communications technology and services. Cisco has more than 70,000 employees and annual revenue of US$...

. Many devices don't use either of these standards. 10P10C connectors can be found on some devices as well. Digital Equipment Corporation
Digital Equipment Corporation
Digital Equipment Corporation was a major American company in the computer industry and a leading vendor of computer systems, software and peripherals from the 1960s to the 1990s...

 defined their own DECconnect connection system which was based on the Modified Modular Jack
Modified Modular Jack
The DECconnect Modified Modular Jack is a variation of the 6P6C modular connector and was developed by Digital Equipment Corporation. The main difference from the conventional modular connector is that the hook is toward the side instead of the center of the plug, making it impossible to insert a...

 (MMJ) connector. This is a 6 pin modular jack
Jack (connector)
In electronics and electrical assemblies, the term jack commonly refers to a surface-mounted connector, often, but not always, with the female electrical contact or socket, and is the "more fixed" connector of a connector pair...

 where the key is offset from the center position. As with the Yost standard, DECconnect uses a symmetrical pin layout which enables the direct connection between two DTEs. Another common connector is the DH10 header connector common on motherboards and add-in cards which is usually converted via a cable to the more standard 9 pin DE-9
D-subminiature
The D-subminiature or D-sub is a common type of electrical connector. They are named for their characteristic D-shaped metal shield. When they were introduced, D-subs were among the smaller connectors used on computer systems....

 connector (and frequently mounted on a free slot plate or other part of the housing).

Pinouts


The following table lists commonly-used RS-232 signals and pin assignments.
Signal | Origin | DB-25
D-subminiature
The D-subminiature or D-sub is a common type of electrical connector. They are named for their characteristic D-shaped metal shield. When they were introduced, D-subs were among the smaller connectors used on computer systems....

 pin
| DE-9
D-subminiature
The D-subminiature or D-sub is a common type of electrical connector. They are named for their characteristic D-shaped metal shield. When they were introduced, D-subs were among the smaller connectors used on computer systems....

 pin
| TIA-561 pin | Yost pin | DEC MMJ
Name | Typical purpose Abbreviation DTE
Data terminal equipment
Data Terminal Equipment is an end instrument that converts user information into signals or reconverts received signals. These can also be called tail circuits. A DTE device communicates with the data circuit-terminating equipment...

 
DCE
Data circuit-terminating equipment
A data circuit-terminating equipment is a device that sits between the data terminal equipment and a data transmission circuit. It is also called data communications equipment and data carrier equipment...

Data Terminal Ready
Data Terminal Ready
Data Terminal Ready, abbreviated as DTR, is a control signal present inside an RS-232 serial communications cable that goes between a computer and another device, such as a modem...

 
OOB
Out-of-band
The term out-of-band has different uses in communications and telecommunication. In case of out-of-band control signaling, signaling bits are sent in special order in a dedicated signaling frame...

 control signal: Tells DCE that DTE is ready to be connected.
DTR 20 4 3 2 1
Data Carrier Detect
Data Carrier Detect
Data Carrier Detect, abbreviated as DCD, or alternately Carrier Detect abbreviated as CD, is a control signal present inside an RS-232 serial communications cable that goes between a computer and another device, such as a modem. This signal is a simple "high/low" status bit that is sent "from DCE...

 
OOB control signal: Tells DTE that DCE is connected to telephone line. DCD 8 1 2 7 6
Data Set Ready OOB control signal: Tells DTE that DCE is ready to receive commands or data. DSR 6 6 1
Ring Indicator
Ring Indicator
Ring Indicator, abbreviated as RI, is a control signal that is used in RS-232 serial communications cables between a computer and a modem. The signal is sent from the modem to the computer, typically over pin 9 of a nine-pin serial port, or pin 22 of a 25-pin serial port...

 
OOB control signal: Tells DTE that DCE has detected a ring signal on the telephone line. RI 22 9
Request To Send OOB control signal: Tells DCE to prepare to accept data from DTE. RTS 4 7 8 1
Clear To Send OOB control signal: Acknowledges RTS and allows DTE to transmit. CTS 5 8 7 8
Transmitted Data Data signal: Carries data from DTE to DCE. TxD 2 3 6 3 2
Received Data Data signal: Carries data from DCE to DTE. RxD 3 2 5 6 5
Common Ground GND common 7 5 4 4, 5 3, 4
Protective Ground PG common 1


The signals are named from the standpoint of the DTE, for example, an IBM-PC compatible serial port. The ground signal is a common return
Single-ended signalling
Single-ended signaling is the simplest and most commonly used method of transmitting electrical signals over wires. One wire carries a varying voltage that represents the signal, while the other wire is connected to a reference voltage, usually ground....

 for the other connections; it appears on two pins in the Yost standard but is the same signal. The DB-25 connector includes a second "protective ground" on pin 1. Connecting this to pin 7 (signal reference ground) is a common practice but not essential.

Note that EIA/TIA 561 combines DSR and RI, and the Yost standard combines DSR and DCD.

Hardware abstraction


Operating systems usually use a symbolic name to refer to the serial ports of a computer.

Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating systems usually label the serial port devices /dev/tty* (TTY is a common trademark-free abbreviation for teletype) where * represents a string identifying the terminal device; the syntax of that string depends on the operating system and the device. On Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, 8250/16550 UART
16550 UART
The 16550 UART is an integrated circuit designed for implementing the interface for serial communications...

 hardware serial ports are named /dev/ttyS*, USB adapters appear as /dev/ttyUSB* and various types of virtual serial ports do not necessarily have names starting with tty.

The Microsoft MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

 and Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 environments refer to serial ports as COM ports: COM1, COM2, etc.

Common applications for serial ports


The RS-232 standard is used by many specialized and custom-built devices. This list includes some of the more common devices that are connected to the serial port on a PC. Some of these such as modems and serial mice are falling into disuse while others are readily available.

Serial ports are very common on most types of microcontroller
Microcontroller
A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM...

, where they can be used to communicate with a PC or other serial devices.
  • Dial-up modem
    Modem
    A modem is a device that modulates an analog carrier signal to encode digital information, and also demodulates such a carrier signal to decode the transmitted information. The goal is to produce a signal that can be transmitted easily and decoded to reproduce the original digital data...

    s
  • GPS
    Global Positioning System
    The Global Positioning System is a space-based global navigation satellite system that provides location and time information in all weather, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites...

     receivers (typically NMEA 0183 at )
  • Bar code scanners
    Barcode reader
    A barcode reader is an electronic device for reading printed barcodes. Like a flatbed scanner, it consists of a light source, a lens and a light sensor translating optical impulses into electrical ones...

     and other point of sale
    Point of sale
    Point of sale or checkout is the location where a transaction occurs...

     devices
  • LED
    Light-emitting diode
    A light-emitting diode is a semiconductor light source. LEDs are used as indicator lamps in many devices and are increasingly used for other lighting...

     and LCD
    Liquid crystal display
    A liquid crystal display is a flat panel display, electronic visual display, or video display that uses the light modulating properties of liquid crystals . LCs do not emit light directly....

     text displays
  • Satellite phone
    Satellite phone
    A satellite telephone, satellite phone, or satphone is a type of mobile phone that connects to orbiting satellites instead of terrestrial cell sites...

    s, low-speed satellite modems and other satellite based transceiver devices
  • Flat-screen (LCD and Plasma) monitors to control screen functions by external computer, other AV components or remotes
  • Test and measuring equipment such as digital multimeter
    Multimeter
    A multimeter or a multitester, also known as a VOM , is an electronic measuring instrument that combines several measurement functions in one unit. A typical multimeter may include features such as the ability to measure voltage, current and resistance...

    s and weighing systems
  • Updating Firmware
    Firmware
    In electronic systems and computing, firmware is a term often used to denote the fixed, usually rather small, programs and/or data structures that internally control various electronic devices...

     on various consumer devices.
  • Some CNC controllers
    Numerical control
    Numerical control refers to the automation of machine tools that are operated by abstractly programmed commands encoded on a storage medium, as opposed to controlled manually via handwheels or levers, or mechanically automated via cams alone...

  • Uninterruptible power supply
    Uninterruptible power supply
    An uninterruptible power supply, also uninterruptible power source, UPS or battery/flywheel backup, is an electrical apparatus that provides emergency power to a load when the input power source, typically mains power, fails...

  • Software debuggers that run on a 2nd computer.
  • Industrial field buses

Historic uses

  • Printers
  • Computer terminal
    Computer terminal
    A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system...

    , teletype
  • Older digital camera
    Digital camera
    A digital camera is a camera that takes video or still photographs, or both, digitally by recording images via an electronic image sensor. It is the main device used in the field of digital photography...

    s
  • Networking
    Computer network
    A computer network, often simply referred to as a network, is a collection of hardware components and computers interconnected by communication channels that allow sharing of resources and information....

     (Macintosh AppleTalk
    AppleTalk
    AppleTalk is a proprietary suite of protocols developed by Apple Inc. for networking computers. It was included in the original Macintosh released in 1984, but is now unsupported as of the release of Mac OS X v10.6 in 2009 in favor of TCP/IP networking...

     using RS-422 at )
  • Serial mouse
    Mouse (computing)
    In computing, a mouse is a pointing device that functions by detecting two-dimensional motion relative to its supporting surface. Physically, a mouse consists of an object held under one of the user's hands, with one or more buttons...

  • Older Joystick
    Joystick
    A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. Joysticks, also known as 'control columns', are the principal control in the cockpit of many civilian and military aircraft, either as a center stick or...

    s
  • Older GSM mobile phones


Since the control signals for a serial port can be easily turned on and off by a switch, some applications used the control lines of a serial port to monitor external devices, without exchanging serial data. The most important commercial application of this principle was for some models of uninterruptible power supply
Uninterruptible power supply
An uninterruptible power supply, also uninterruptible power source, UPS or battery/flywheel backup, is an electrical apparatus that provides emergency power to a load when the input power source, typically mains power, fails...

 which used the control lines to signal "loss of power", "battery low alarm" and other status information. At least some Morse code
Morse code
Morse code is a method of transmitting textual information as a series of on-off tones, lights, or clicks that can be directly understood by a skilled listener or observer without special equipment...

 training software used a code key connected to the serial port, to simulate actual code use. The status bits of the serial port could be sampled very rapidly and at predictable times, making it possible for the software to decipher Morse code.

Settings


Many settings are required for serial connections used for asynchronous start-stop
Asynchronous start-stop
Asynchronous serial communication describes an asynchronous, serial transmission protocol in which a start signal is sent prior to each byte, character or code word and a stop signal is sent after each code word...

 communication, to select speed, number of data bits per character, parity, and number of stop bits per character. In modern serial ports using a UART integrated circuit, all settings are usually software-controlled; hardware from the 1980s and earlier may require setting switches or jumpers on a circuit board. One of the simplifications made in such serial bus standards as Ethernet, FireWire, and USB is that many of those parameters have fixed values so that users can not and need not change the configuration; the speed is either fixed or automatically negotiated. Often if the settings are entered incorrectly the connection will not be dropped; however, any data sent will be received on the other end as nonsense.

Speed


Serial ports use two-level (binary) signaling, so the data rate in bits per second is equal to the symbol rate in baud
Baud
In telecommunications and electronics, baud is synonymous to symbols per second or pulses per second. It is the unit of symbol rate, also known as baud rate or modulation rate; the number of distinct symbol changes made to the transmission medium per second in a digitally modulated signal or a...

s. A standard series of rates is based on multiples of the rates for electromechanical teleprinter
Teleprinter
A teleprinter is a electromechanical typewriter that can be used to communicate typed messages from point to point and point to multipoint over a variety of communication channels that range from a simple electrical connection, such as a pair of wires, to the use of radio and microwave as the...

s; some serial ports allow many arbitrary rates to be selected. The port speed and device speed must match. The capability to set a bit rate does not imply that a working connection will result. Not all bit rates are possible with all serial ports. Some special-purpose protocols such as MIDI for musical instrument control, use serial data rates other than the teleprinter series. Some serial port systems can automatically detect the bit rate.

The speed includes bits for framing (stop bits, parity, etc.) and so the effective data rate is lower than the bit transmission rate. For example with 8-N-1
8-N-1
8-N-1 is a common shorthand notation for a serial port parameter setting or configuration in asynchronous mode, in which there are eight data bits, no parity bit, and one stop bit....

 character framing only 80% of the bits are available for data (for every eight bits of data, two more framing bits are sent).

Common bit rates include 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600 and 115200 bit/s.

Data bits


The number of data bits in each character can be 5 (for Baudot code
Baudot code
The Baudot code, invented by Émile Baudot, is a character set predating EBCDIC and ASCII. It was the predecessor to the International Telegraph Alphabet No 2 , the teleprinter code in use until the advent of ASCII. Each character in the alphabet is represented by a series of bits, sent over a...

), 6 (rarely used), 7 (for true ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

), 8 (for any kind of data, as this matches the size of a byte
Byte
The byte is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, a byte was the number of bits used to encode a single character of text in a computer and for this reason it is the basic addressable element in many computer...

), or 9 (rarely used). 8 data bits are almost universally used in newer applications. 5 or 7 bits generally only make sense with older equipment such as teleprinters.

Most serial communications designs send the data bits within each byte LSB (Least Significant Bit) first. This standard is also referred to as "little endian". Also possible, but rarely used, is "big endian" or MSB (Most Significant Bit) first serial communications. (See Endianness
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 for more about bit ordering.) The order of bits is not usually configurable, but data can be byte-swapped only before sending.

Parity



Parity is a method of detecting errors in transmission. When parity is used with a serial port, an extra data bit is sent with each data character, arranged so that the number of 1 bits in each character, including the parity bit, is always odd or always even. If a byte is received with the wrong number of 1s, then it must have been corrupted. However, an even number of errors can pass the parity check.

Electromechanical teleprinters were arranged to print a special character when received data contained a parity error, to allow detection of messages damaged by line noise. A single parity bit
Parity bit
A parity bit is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code....

 does not allow implementation of error correction on each character, and communication protocols
Communications protocol
A communications protocol is a system of digital message formats and rules for exchanging those messages in or between computing systems and in telecommunications...

 working over serial data links will have higher-level mechanisms to ensure data validity and request retransmission of data that has been incorrectly received.

The parity bit in each character can be set to none (N), odd (O), even (E), mark (M), or space (S). None means that no parity bit is sent at all. Mark parity means that the parity bit is always set to the mark signal condition (logical 1) and likewise space parity always sends the parity bit in the space signal condition. Aside from uncommon applications that use the 9th (parity) bit for some form of addressing or special signalling, mark or space parity is uncommon, as it adds no error detection information. Odd parity is more common than even, since it ensures that at least one state transition occurs in each character, which makes it more reliable. The most common parity setting, however, is "none", with error detection handled by a communication protocol.

Stop bits


Stop bits sent at the end of every character allow the receiving signal hardware to detect the end of a character and to resynchronise with the character stream. Electronic devices usually use one stop bit. If slow electromechanical teleprinter
Teleprinter
A teleprinter is a electromechanical typewriter that can be used to communicate typed messages from point to point and point to multipoint over a variety of communication channels that range from a simple electrical connection, such as a pair of wires, to the use of radio and microwave as the...

s are used, one-and-one half or two stop bits are required.

Conventional notation


The D/P/S (Data/Parity/Stop) conventional notation specifies the framing of a serial connection. The most common usage on microcomputers is 8/N/1 (8N1). This specifies 8 data bits, no parity, 1 stop bit. In this notation, the parity bit is not included in the data bits. 7/E/1 (7E1) means that an even parity bit is added to the seven data bits for a total of eight bits between the start and stop bits. If a receiver of a 7/E/1 stream is expecting an 8/N/1 stream, half the possible bytes will be interpreted as having the high bit set.

Flow control



A serial port may use signals in the interface to pause and resume the transmission of data. For example, a slow printer might need to handshake
Handshaking
In information technology, telecommunications, and related fields, handshaking is an automated process of negotiation that dynamically sets parameters of a communications channel established between two entities before normal communication over the channel begins...

 with the serial port to indicate that data should be paused while the mechanism advances a line.

Common hardware handshake signals (hardware flow control) use the RS-232 RTS/CTS or DTR/DSR signal circuits. Generally, the RTS and CTS are turned off and on from alternate ends to control data flow, for instance when a buffer is almost full. DTR and DSR are usually on all the time and, per the RS-232 standard and its successors, are used to signal from each end that the other equipment is actually present and powered-up. However, manufacturers have over the years built many devices that implemented non-standard variations on the standard, for example, printers that use DTR as flow control.

Another method of flow control (software flow control) uses special characters such as XON/XOFF
Xon/Xoff
Software flow control is a method of flow control used in computer data links, especially RS-232 serial. It uses special codes, transmitted in-band, over the primary communications channel. These codes are generally called XOFF and XON . Thus, "software flow control" is sometimes called...

 to control the flow of data. The XON/XOFF characters are sent by the receiver to the sender to control when the sender will send data, that is, these characters go in the opposite direction to the data being sent. The circuit starts in the "sending allowed" state. When the receiver's buffers approach capacity, the receiver sends the XOFF character to tell the sender to stop sending data. Later, after the receiver has emptied its buffers, it sends an XON character to tell the sender to resume transmission. These are non-printing characters and are interpreted as handshake signals by printers, terminals, and computer systems.

XON/XOFF flow control is an example of inband signaling, in which control information is sent over the same channel used for the data. If the XON and XOFF characters might appear in the data being sent, XON/XOFF handshaking presents difficulties, as receivers may interpret them as flow control. Such characters sent as part of the data stream must be encoded in an escape sequence
Escape sequence
An escape sequence is a series of characters used to change the state of computers and their attached peripheral devices. These are also known as control sequences, reflecting their use in device control. Some control sequences are special characters that always have the same meaning...

 to prevent this, and the receiving and sending software must generate and interpret these escape sequences. On the other hand, since no extra signal circuits are required, XON/XOFF flow control can be done on a 3 wire interface.

"Virtual" serial ports


A virtual serial port is an emulation of the standard serial port. This port is created by software which enable extra serial ports in an operating system without additional hardware installation (such as expansion card
Expansion card
The expansion card in computing is a printed circuit board that can be inserted into an expansion slot of a computer motherboard or backplane to add functionality to a computer system via the expansion bus.One edge of the expansion card holds the contacts that fit exactly into the slot...

s, etc.). It is possible to create a large number of virtual serial ports in a PC. The only limitation is the amount of resources, such as operating memory and computing power, needed to emulate many serial ports at the same time.

Virtual serial ports emulate all hardware serial port functionality, including Baud rate, Data bits, Parity bits, Stop bits, etc. Additionally they allow controlling the data flow, emulating all signal lines (DTR/DSR/CTS/RTS/DCD/RI) and customizing pinout. Virtual serial ports are common with Bluetooth
Bluetooth
Bluetooth is a proprietary open wireless technology standard for exchanging data over short distances from fixed and mobile devices, creating personal area networks with high levels of security...

 and are the standard way of receiving data from Bluetooth-equipped GPS modules.

Virtual serial port emulation can be useful in case there is a lack of available physical serial ports or they do not meet the current requirements. For instance, virtual serial ports can share data between several applications from one GPS device connected to a serial port. Another option is to communicate with any other serial devices via internet or LAN as if they are locally connected to computer (Serial-over-Ethernet technology). Two computers or applications can communicate through an emulated serial port link. Virtual serial port emulators are available for Microsoft Windows and some of them run under Windows CE, Windows Mobile and Pocket PC.