(Latest Revision: 09/10/2002)
Notes On Chapter Five
-- Local Aynchronous Communication (RS-232)
- 5.1 Introduction
- How can one send bits through short distances over an electrical
conductor?
- 5.2 The Need For Asynchronous Communication
- In asynchronous (async) communication, the sender sends whenever
it is ready. There is no need to synchronize with the receiver
first. The signal does not contain information that tells where
individual bits begin or end.
- 5.3 Using Electric Current To Send Bits
- There are many possible ways to do this. The simplest idea is
perhaps just to put a negative voltage on the line to represent
1, and a positive voltage to represent 0.
- 5.4 Standards for Communication
- One must have standards to agree on symbols, voltages to be used
to represent symbols, how long pulses last, how close together
they can be, etc.
- RS-232 is a widely used standard for sending characters
asynchronously over a wire by transmitting bits one after another
(serially).
- According to RS-232, the line is held low (to -15 volts) when
idle. There is a certain duration of time T for sending a bit.
When starting to send a character, the line is held high (at +15
volts) for time T. This allows the receiver to detect that a
character will be coming. Next each bit of the character is
impressed on the line for time T each, with no spacing in between
bits. Low means "1" and high means "0." After the last bit of
the character has been sent the sender brings the line low for at
least time T, after which it may send another character when it
wishes.
- Using a timer, the receiver samples each sent bit several times
and computes an average value of the sampled voltage, and
"decides" the value of each bit -- "O" or "1".
- 5.5 Baud Rate, Framing, And Errors
- The time T is something the sender and receiver must agree upon.
T determines the baud rate -- how often the voltage can change in
a second, and how fast information can be sent. The actual
measurements used most often are baud rates like 19,200 bits per
second. Typically RS-232 hardware can be configured to operate
in some range of baud rates. Often a mismatch between sender and
receiver baud rates will be detected by the receiver and reported
as a framing error. The receiver detects framing errors by
noticing that multiple samples of a bit do not agree, or by
noticing that the stop bit does not arrive when it should. The
break key on a computer keyboard causes a framing error.
- Technically baud is not the same as bits per second. (They
amount to the same thing in the case of RS-232.) If the voltage
can change to more than two distinct levels, then more than one
bit can be encoded in a voltage change. In that case the baud
rate is different than the bit rate.
- For example if there are eight different voltage levels to which
the line can change, then each voltage change communicates one of
eight values. This is equivalent to transmitting 3 bits of
information because there are 8 patterns possible in a set of 3
bits. So in this case if the baud rate is R changes per second
then the bit rate is 3R bits per second.
- Keep in mind, however, that this discussion ignores the
"overhead" of sending start and stop bits, parity bits, and so
on.
- 5.6 Full Duplex, Asynchronous Communication
- RS-232 actually is pretty complex and describes the roles of 25
wires, most of which are used for specialized control functions,
and are not often needed.
- Under RS-232, data can flow between two devices in both
directions simultaneously -- full duplex communication. There is
a wire for each direction of communication, plus a ground wire
that is shared.
- "Clear to Send" is one of the control line functions. This is
used by the receiver to tell the sender to keep sending.
- Computers and modems use different pin numbers for sending and
receiving data. A computer sends on 2 and receives on 3. A
modem sends on 3 and receives on 2. With this set up, you can
connect a computer to a modem without crossing the 2-3 wires. Of
course, it means you *do* have to cross them if you are
connecting two computers.
- 5.7 Limitations Of Real Hardware
- Real hardware does not transmit perfect square waves. This is
the reason that several samples are taken of each bit value in
the RS-232 standard. Also care is taken to gather samples in the
middle of the time interval during which the bit is supposed to
be transmitted, since the "edge" values are more likely to be
erroneous.
- 5.8 Hardware Bandwidth And The Transmission Of Bits
- There are limits to how fast voltage levels can change on a wire,
and limits to how many distinct voltage levels can be sensed by
hardware. Therefore there is a limit to how many bits per second
can be sent down a wire. The same principle applies to any
communication channel.
- We measure the data rate limit of a channel indirectly, by using
bandwidth -- the highest frequency at which an oscillating signal
can be sent down the channel. Bandwidth is measure in Hertz
(cycles per second).
- Basically the Nyquist sampling theorem states that the highest
possible data rate would come about by detecting one voltage
change for each half-cycle of the bandwidth frequency. Therefore
the max baud rate of a channel is 2B where B is the Bandwidth.
If K voltage levels are possible then each voltage level
transmits logK bits. Therefore the Nyquist bit rate limit is
2B(logK).
- 5.9 The Effect Of Noise On Communication
- Important work done by Claude Shannon shows that max data rate is
further limited by the effect of the presence of interference and
other "noise." Shannon's Theorem is that
C = B(log(1+(S/N))
where C is the effective max on channel capacity in bits per
second, B is the "hardware" bandwidth, S is the average signal
power, N is the average noise power, and the logarithm is to the
base 2.
S/N is the so-called signal-to-noise ratio. Actually, the
quantity engineers use is equal to ten times the common logarithm
of S/N. So for example if the power of the signal is 1000 times
the power of the noise then log(S/N) is 3 and so the "decibel"
level is 10*3 = 30 decibels. Also, since log(1+(1000) is barely
more than log(1000) == about 10 (this log is log-base-two)), the
value of C in this case would be around 10B. That's a bit rate
of ten times the "hardware" bandwidth.
- In fact, a typical telephone line actually does have a
signal-to-noise ratio of about 30 dB. Also the hardware
bandwidth of a telephone line is about 3000 Hz. Therefore
Shannon's Theorem tells us that we can't transmit data at a rate
of more than about 30,000 bits per second over a typical phone
line.
- 5.10 Significance For Data Networking
- Nyquist's theorem is an incentive to find clever ways to encode
more voltage changes per unit time, thus increasing the
theoretical bit rate limit.
- Shannon's theorem let's us know the limitations stemming from the
signal-to-noise characteristic of the channel.
- 5.11 Summary