Serial port

Missing image
Serialport.jpg
A male DE-9 serial port on the rear panel of a PC.

In computing, a serial port is an interface on a computer system with which information is transferred in or out one bit at a time (contrast parallel port). Throughout most of the history of personal computers, this was accomplished using the RS-232 standard over simple cables connecting the computer to a device such as a terminal or modem. Mice, keyboards, and other devices were also often connected this way.

Contents

Hardware

On the IBM PC and compatible computers, the standard serial ports were implemented with a special-purpose hardware chip, called a UART, that converted characters to serial form. Very early personal computers used a variety of UART chips with slightly different programming models. Some machines, particularly low-cost home computers would not use a dedicated chip at all and instead would use the CPU to send the data through an output pin, using the so-called bit-banging technique.

While RS-232 originally specified a 25-pin D-type connector, many personal computer designers chose to implement only a subset of the full standard. Compatibility with the standard was exchanged for use of less costly and more compact connectors, (in particular the DE-9 version used by the original IBM PC-AT).

On many models of Macintosh the related RS-422 standard was popular, and often used German DIN connectors.

In very recent years, more advanced electronics has made possible more reliable and higher-speed serial communications, so RS-232 is being supplanted by newer standards such as USB and FireWire. These make it possible to connect devices that would not have been feasible over slower serial connections, such as storage devices and sound and video devices.

In Linux, the serial port devices are usually called /dev/ttyS* where * is a number starting with 0. In Windows (particularly older versions such as Windows 3.x or Windows 95) serial ports are referred to as COM1, COM2, etc.

Port addresses

Traditionally IBM PC systems have allocated their first four serial ports according to the configuration in the table below. Note that Microsoft design references since 1997 have deprecated use of an RS- 232 serial port and some Windows-compatible personal computers are no longer equipped with these ports as standard.

PORT NAME Interrupt # Starting I/O Ending I/O
COM1 IRQ 4 0x3f8 0x3ff
COM2 IRQ 3 0x2f8 0x2ff
COM3 IRQ 4 0x3e8 0x3ef
COM4 IRQ 3 0x2e8 0x2ef

Settings

There is a multitude of software settings for serial connections. Most common settings are speed, parity, and stop bits.

Speed

Speed is bit speed from one device to another in bits per second (bit/s). Common bit rates per second are 300, 1200, 2400, 9600, 19200, etc. Typically both devices must be set to the same speed but some devices (such as modems) may be set to autodetect speed. Although the RS 232 standard is formally limited to 20,000 bits per second, serial ports on popular personal computers allow settings up to 115,000 bits per second, though not all bit rates are possible with all serial port clock generators.

Parity

Parity is a method of checking the accuracy of transmitted characters. In the context of personal computers, parity is usually not used, but can be odd or even. Parity none is simple, the data is not changed. In even parity the data is arranged so that the total count of 1 bits in each data character is an even number, by setting a parity bit to parity bit (usually the last or most significant bit) to be a 0 or 1 accordingly. In odd parity the number of 1 bits is an odd number. Parity can be used by the receiver to detect transmission errors - if a byte is received with the wrong number of 1 bits, then it must have been corrupted. If parity is correct there may have been no errors or an even number of errors. A single parity bit does not allow implementation of error correction on each character, and communication protocols working over serial data links have higher-level checksums to insure data validity and request retransmission of data that has been incorrectly received.

Stop bits

Stop bits are sent at the end of every byte transmitted in order to allow the receiving signal hardware to resynchronise. Electronic devices usually use one stop bit. Occasionally, and especially if electromechanical devices are used such as printers, one-and-one half or two stop bits are required.

Conventional notation

The D/P/S 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. The number of data bits can be 7, 8, or (sometimes) 9. Parity is specified as none (N), odd (O), or even (E), with some systems supporting mark (M) or space (S) to denote a constant 1 or 0 bit for parity.

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.

Miscellaneous

Other settings define when pins will send handshake signals, or other data integrity checks. Common combinations are RTS/CTS, DTR/DSR, or XON/XOFF (which actually does not use connector pins but rather special characters inserted into the data streams).

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 XON character tells the sender that the receiver is ready for more data. The XOFF character tells the sender to stop sending characters until the receiver is ready again. The use of XON/XOFF is deprecated, and it is preferable to use RTS/CTS flow control instead.

XON/XOFF is an in-band method that works between the endpoints, but both ends must support the protocol, and there is the potential for confusion in starting up. It can be done on a 3 wire interface. RTS/CTS was originally intended to allow the teletype and the modem to coordinate half-duplex links where only one modem could transmit at a time. The terminal would raise Request To Send and wait for the modem to respond with Clear To Send. RTS/CTS is a hardware handshake, but it does have advantages.

See also

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools