The Lab Book Pages

An online collection of electronics information

http://www.labbookpages.co.uk

Dr. Andrew Greensted
Last modified: 18th November 2009

Hide Menu


Valid XHTML Valid CSS
Valid RSS VIM Powered
RSS Feed Icon

This site uses Google Analytics to track visits. Privacy Statement

Page Icon

PC Serial Port

Information on the PC Serial Port


Serial Frame

Serial Frame Format

Serial Frame Format

The table below shows some serial frame specs for different baud rates.

Baud Bit Width Frame Width
(1 start bit, 8 data bits)
Real Data Rate *
(1 start bit, 8 data bits, no parity, 1 stop bit)
4800 208.33us 1875us 480 Bytes/s 0.47 KBytes/s
9600 104.17us 937.5us 960 Bytes/s 0.94 KBytes/s
19200 52.08us 468.75us 1920 Bytes/s 1.88 KBytes/s
38400 26.04us 234.38us 3840 Bytes/s 3.75 KBytes/s
57600 17.36us 156.25us 5760 Bytes/s 5.63 KBytes/s
115200 8.68us 78.13us 11520 Bytes/s 11.25 KBytes/s

* It takes a minimum of 10 bits (1 start bit, 8 data bits, no parity, 1 stop bit) to transfer 8 bits of real data. Real data rate is equal to 1/(bitwidth * 10), or Baud/10.


Linux Serial Port Setup

stty is a command line tool for setting up the serial port. Below are some examples of use.

Set Baud to 9600, use one stop bits.

> stty -F /dev/ttyS0 9600 -cstopb

Set Baud to 115200, use two stop bits.

> stty -F /dev/ttyS0 115200 cstopb

Set Baud to 115200 and character size to 5 bits (can be 5 to 8). Enable parity, set to odd parity.

> stty -F /dev/ttyS0 115200 cs5 parenb parodd

Set Baud to 115200 and character size to 8 bits. Enable parity, set to even parity.

> stty -F /dev/ttyS0 115200 cs8 parenb -parodd

Book Logo