Hardware Reference
In-Depth Information
misinterpreted. If your serial terminal is showing lots of strange characters, then
there is a chance that the baud rate is not the same between the two devices.
A baud rate of 1,000 baud is synonymous to a bit rate of 1,000 bits per second.
However, that does not mean that 1,000 bits of data are sent. The data is encap-
sulated , placed inside other bits that help the computer identify the data being
sent. RS-232 allows asynchronous communications, meaning that the commu-
nications line does not require a clock signal, and communications can begin
and stop at any time instead of requiring a constant l ow. RS-232 needs some
way of telling the receiver that they are about to send data and that they have
i nished sending a packet. For this reason, RS-232 connections almost always
have a start bit, 8 data bits, and a stop bit for a total of 10 bits. Some parameters
allow for an extra parity bit, or two stop bits, for a total of 12 bits, while only
transmitting 8 bits of data. An example data packet is illustrated in Figure 5-3.
Start
Data
Parity
Stop
1 bit
5-9 bits
0-1 bits
1-2 bits
Figure 5-3: A serial packet containing data
Various baud rates exist; most are either multiples of the original baud rate,
75 baud, or multiples of crystal oscillators. Most UART devices are capable of
multiple speeds: 300, 1,200, 2,400, 4,800, 9,600, 19,200, 38,400, 57,600, and 115,200
are the most common. Some chips can go even faster. Other devices have non-
standard speeds; you need to i nd a speed supported by both the sender and the
receiver. In embedded systems, 9,600, 19,200, and 115,200 are common values.
Data Bits
The number of data bits in each packet can be between 5 and 9 bits. Often this
data is used to represent a character or symbol. Five data bits are typically used
for Baudot code, a character table predating ASCII that gave baud its name. Seven
data bits are used for pure ASCII characters. Most modern systems use 8 bits
because that corresponds to 1 byte. Do not try to speed up data throughput by
lowering the amount of data bits, even if you are sending only ASCII. It is best
to remain compatible with as many devices as possible and to use 8 data bits,
unless the other equipment does not let you use the default 8 bits.
Parity
Parity is used as error detection, attempting to detect transmission errors. A par-
ity bit can be added to make the number of 1s in a packet even or odd. Receiving
equipment can detect transmission errors and request the sending equipment to
re-send data if the data has unexpected information. This was mainly used on
 
Search WWH ::




Custom Search