CSIT 220 (Blum)1 RS-232 (Local Asynchronous Communication) Based on Chapter 5 in Computer Networks...
Preview:
Citation preview
- Slide 1
- CSIT 220 (Blum)1 RS-232 (Local Asynchronous Communication)
Based on Chapter 5 in Computer Networks and Internets by D.
Comer
- Slide 2
- CSIT 220 (Blum)2 Human-Computer Communication Computers are not
designed to perform some particular large-scale task, instead they
are designed to perform a set of small-small tasks. Programming a
computer consists of instructing it to perform the small-scale
tasks in some particular order. We must communicate our program to
the computer. At a higher level we communicate which programs we
want executed. This level of communication is not between two
computers but between a computer and its peripheral devices and
ultimately between computer and user.
- Slide 3
- CSIT 220 (Blum)3 Categorization I: Directionality One scheme
for categorizing communication systems is based on the direction(s)
in which information flows, i.e. one way or two way. Simplex
Half-duplex Full-duplex
- Slide 4
- CSIT 220 (Blum)4 Simplex Information flows in only one
direction. There are separate transmitters and receivers. Example:
radio The radio station has the transmitter. The listener only
receives the signal that is, your radio is a receiver.
- Slide 5
- CSIT 220 (Blum)5 Half-duplex Information flows in both
directions, but only one direction at a time. Each unit has a
transmitter and receiver, but it is either in a transmitting or
receiving mode. Example: walkie-talkie only one person can talk at
a time
- Slide 6
- CSIT 220 (Blum)6
- Slide 7
- 7 Full-duplex Information flows in two directions
simultaneously. The transmitter and receiver are both continuously
operational. Example: telephone Each person can talk and listen all
of the time.
- Slide 8
- CSIT 220 (Blum)8 Modem: full or half Many modems can work in
either mode (half- or full-duplex). A switch determines which. In
half-duplex mode, there is a local echo, each character transmitted
is also displayed locally In full-duplex mode, there is a remote
echo, each character is displayed only after it was transmitted and
returned by the distant device (so you know it got there
intact).
- Slide 9
- CSIT 220 (Blum)9 Categorization II: Timing Another scheme for
categorizing communication systems is based on the timing between
the transmission of characters or bytes. Asynchronous Synchronous
Isochronous
- Slide 10
- CSIT 220 (Blum)10
- Slide 11
- CSIT 220 (Blum)11 Synchronous definitions When we talked about
satellites, we used definition #4. (Recall geosynchronous.) For
this lecture we will focus on definition #5 concerning whether
characters are transmitted as a group or individually. You might
use definition #1 if you were comparing a chat session
(synchronous, i.e. requires that people logged on at same time) to
a discussion database (asynchronous, i.e. people can be logged on
at different times).
- Slide 12
- CSIT 220 (Blum)12 Asynchronous (definition #4) One character
(byte of data) at a time. There is an unknown length of time
between the sending of one character and the next; the data flow is
intermittent. ABC Different times between character
transmissions
- Slide 13
- CSIT 220 (Blum)13 Synchronous (definition #4) Data is
transmitted in large groups of characters (frame). Within the
frame, character transmissions are sent at regular intervals. So
one character immediately follows the next and so on.
ABCDEFGHIJK
- Slide 14
- CSIT 220 (Blum)14 Asynchronous vs. Synchronous Asynchronous is
less restrictive than synchronous Synchronous requires more from
the hardware and a greater degree of coordination between
transmitter and receiver. Asynchronous is slower/less efficient
than synchronous The percentage of the signal that is not actual
data is higher in asynchronous.
- Slide 15
- CSIT 220 (Blum)15 Asynchronous Example The connection between
the keyboard and the computer is often asynchronous. The
information is transmitted a character (keystroke) at a time. The
information arrives slowly and intermittently. (Its possible to
buffer the keyboard input before transmitting it to the
computer.)
- Slide 16
- CSIT 220 (Blum)16 Beginning, middle and end Synchronous and
asynchronous both have Beginning: Im sending you data Middle: the
actual data End: Im done Overhead: the percentage of information
that is not actual data Overhead = Beg+End 100% Beg + Mid +
End
- Slide 17
- CSIT 220 (Blum)17 Overhead example Let us assume that we are
sending a byte (8 bits) of data, that there is no parity (error
detection) bit, that there is one bit to indicate the start of the
transmission, and that there is one bit to indicate the end of the
transmission. Then the overhead is: Overhead =1 + 1 100% = 20% 1 +
8 + 1
- Slide 18
- CSIT 220 (Blum)18 Isochronous Character transmissions are sent
at regular intervals but some of them may be empty. So the length
of time between the sending of one character and the next is some
multiple of the time it takes to send one character. ABC More
restrictive than asynchronous, less restrictive than
synchronous.
- Slide 19
- CSIT 220 (Blum)19 Speed and accuracy The desire is for the
information to be conveyed as quickly and as accurately as
possible. These two factors compete: Factors which improve the
speed, such as representing more levels (states), can reduce the
accuracy. Factors which improve accuracy, such as adding error
correcting codes, can slow down transmission (since extra bits are
sent).
- Slide 20
- CSIT 220 (Blum)20 Noise Unpredictable energy (waves) that
permeate the environment. They can never be completely eliminated.
The noise waves add to the waves carrying a signal, changing it.
Enough noise will corrupt the information being carried. Occurs in
digital and analog signals alike, but the information in a digital
signal is more robust against the effect of noise.
- Slide 21
- CSIT 220 (Blum)21 External and internal noise Noise is
sometimes divided into two categories: internal and external
Internal: generated within the communication devices External:
generated outside of the communication devices Wired communication
is less susceptible to external noise since the channel is somewhat
isolated from its environment. In wireless communication, on the
other hand, the channel is the environment.
- Slide 22
- CSIT 220 (Blum)22 Minimizing noise One way to reduce noise is
to reduce a signals bandwidth as much as possible. The smaller the
range of frequencies making up the signal, the smaller the amount
of noise. But reducing the bandwidth reduces the rate of
information flowing. Digitizing helps!
- Slide 23
- CSIT 220 (Blum)23 Digital signals 0 1 1 0 1 0 0 0 These signals
are different if they are analog signals, but they might be the
same if they are digital signals.
- Slide 24
- CSIT 220 (Blum)24 The competition The competition between speed
and accuracy can be seen in the theorems of Nyquist and
Shannon-(Hartley). Nyquists theorem tells one how to send
information faster. But Shannons theorem tells how that speed is
ultimately limited by noise.
- Slide 25
- CSIT 220 (Blum)25 A bit on logarithms Both theorems involve a
logarithm. Recall that a bit (binary digit, a 0 or 1) is the
smallest unit of digital information. The relationship between the
number of bits and the number of states is logarithmic.
- Slide 26
- CSIT 220 (Blum)26 A bit on logarithms (Cont.) One bit Two
states (0, 1) Two bits Four states (00, 01, 10, 11) Three bits
Eight states (000, 001, 010, 011, 100, 101, 110, 111) Number of
States = 2 (Number of bits) Exponential Number of bits = log 2
(Number of States) Logarithmic
- Slide 27
- CSIT 220 (Blum)27 A bit on logarithms (Cont.) Log 2 (1) = 0 Log
2 (2) = 1 Log 2 (4) = 2 Log 2 (8) = 3 Log 2 (16) = 4 Log 2 (32) = 5
Log 2 (64) = 6 Log 2 (128) = 7 Log 2 (256) = 8 Log 2 (512) = 9 Log
2 (1024) = 10 Log 2 (2048) = 11 Log 2 (4096) = 12 Log 2 (8192) = 13
Log 2 (16384) = 14 Etc.
- Slide 28
- CSIT 220 (Blum)28 States Bits So if you know the number of
states, you take the logarithm (base 2) to determine the number of
bits required to represent those states. The number of bits
required is a measurement of the information contained
therein.
- Slide 29
- CSIT 220 (Blum)29 Nyquists theorem D = (2) B Log 2 K Where D is
the maximum data rate in bits per second (bps). Where B is the
bandwidth. Where K is the number of states. This maximum is a goal
for communications engineers, but it is rarely achieved.
- Slide 30
- CSIT 220 (Blum)30 The problem with higher frequencies D = (2) B
Log 2 K Recall the bandwidth can be increased by working at higher
frequencies. So why not just work at high frequencies to increase
the rate of data transmission? Physics says that higher frequency
means higher energy Not only do higher frequency waves (like ultra-
violet or x-rays) take more energy to generate, but they can also
cause more damage (like cancer).
- Slide 31
- CSIT 220 (Blum)31 K= 2 two bits per cycle 1 0 0 1 0 1 0 0 One
cycle 2 possible amplitudes
- Slide 32
- CSIT 220 (Blum)32 K= 4 four bits per cycle 11 01 00 01 10 01 4
possible amplitudes.
- Slide 33
- CSIT 220 (Blum)33 More levels less room for error
- Slide 34
- CSIT 220 (Blum)34 More levels less room for error D = (2) B Log
2 K Note that an error of approximately 0.2 would probably not
cause one to confuse the states represented in the first case, but
it could lead to confusion of states (i.e. data corruption) in the
second case. This is how Shannons theorem places a limit on
Nyquists.
- Slide 35
- CSIT 220 (Blum)35 K=2 with some noise
- Slide 36
- CSIT 220 (Blum)36 K=4 with some noise
- Slide 37
- CSIT 220 (Blum)37 Shannons theorem C = B Log 2 (1 + S/N) Where
C is the channel capacity in bits per second. Where B is the
bandwidth. Where S is the signal power. And where N is the noise
power. The ratio S/N is known as the signal-to- noise ratio.
- Slide 38
- CSIT 220 (Blum)38 Signal-to-noise ratio In communications
(digital or analog), the signal-to-noise ratio, denoted S/N or SNR,
measures a signals strength (power) relative to the background
noise.
- Slide 39
- CSIT 220 (Blum)39 Decibels Sometimes the signal-to-noise ratio
is reported in decibels (S/N) in decibels = 10 Log 10 (S/N) When
using Shannons theorem we do not want S/N expressed in decibels In
some cases, one can produce a larger signal, but that requires more
energy and hence costs more money. Lowering the temperature
sometimes helps since some noise is thermal.
- Slide 40
- CSIT 220 (Blum)40 Local Communication Local communication is
the exchange of information between two things which are close here
it typically refers to exchange between a computer and one of its
peripheral devices. Data from a keyboard or mouse does not flow at
steady rate but rather is intermittent. Thus asynchronous
communication is appropriate.
- Slide 41
- CSIT 220 (Blum)41 Fig. 5-1 A possible approach:
bit-at-a-time
- Slide 42
- CSIT 220 (Blum)42 Pros and Cons of the bit-at-a-time approach
+15 represents 0; -15 represents 1; and 0 corresponds to not
transmitting a bit. Pro: very lenient, not a lot of rules Con:
wastes a lot of time, theres an extra state (0 V) that does not
correspond to any information in the signal and one must spend time
in this state to distinguish for example between two consecutive
1s. And while keyboard data is intermittent, it does tend to come
in bytes instead of bits.
- Slide 43
- CSIT 220 (Blum)43 Fig. 5.2 Framing a group of bits: a byte-
plus-at-a-time
- Slide 44
- CSIT 220 (Blum)44 Protocol In order to improve the speed on the
bit-at-a-time approach, We want to reduce the number of states to
two We want to eliminate the time between bits within a group of
bit that make up one character. We need rules! We need physical
rules so one device does fry the other. We need logical rules so
the devices can agree on the information they are
transmitting.
- Slide 45
- CSIT 220 (Blum)45 Rules In order to distinguish between two
consecutive 1s, we use timing, each bit lasts a set amount of time
If the signal is at 15V for (roughly) twice this interval, that
corresponds to two consecutive 1s. Since the signal is
asynchronous, we also need to distinguish between no signal and a
signal of all 1s.
- Slide 46
- CSIT 220 (Blum)46 Frame All 1s is distinguished from no signal
in that all 1s will a frame. In ordinary language, a frame is an
open border or case for enclosing a picture, mirror, etc. We frame
the information, i.e. place it within a border that indicates where
it begins and ends.
- Slide 47
- CSIT 220 (Blum)47 RS-232 Short for recommended standard-232C
Approved by the Electronic Industries Association (EIA) for
connecting serial devices. In 1987, the EIA released a new version
with the name to EIA-232-D. In 1991, the EIA teamed up with
Telecommunications Industry association (TIA) and issued yet
another version that goes by EIA/TIA-232-E. But still commonly
called RS-232.
- Slide 48
- CSIT 220 (Blum)48 Newer standards While EIA-232 remains the
most common standard for serial communication, the EIA has
developed successors called RS-422 and RS-423. These newer
standards are backward compatible so that devices adhering to the
old standard (RS-232) can be used in a new RS-422 port.
- Slide 49
- CSIT 220 (Blum)49 Serial Port Most personal computers have an
RS232 serial port. Serial refers to sending data bit-by-bit (as
opposed to parallel, in which several bits are sent at once). A
(physical) port is a computer interface to which one can connect a
peripheral device (e.g. mouse, keyboard, modem, etc.)
- Slide 50
- CSIT 220 (Blum)50 Serial ports
- Slide 51
- CSIT 220 (Blum)51 Some terminology A PC has an EIA-232 port for
connecting to a modem or other device. The modem (or other device)
adheres to the EIA- 232 standards (specifications). One calls the
device connecting to the port a Data Communications Equipment (DCE)
and the device to which it connects (e.g., the computer) is called
a Data Terminal Equipment (DTE).
- Slide 52
- CSIT 220 (Blum)52 Connectors The EIA-232 standard supports two
types of connectors a 25-pin D-type connector (DB-25) a 9-pin
D-type connector (DB-9). The type of serial communications used by
PCs requires only 9 pins so either type of connector will work
equally well.
- Slide 53
- CSIT 220 (Blum)53 Why so many pins? If we are sending
information a bit at a time, dont we need just one wire? (Dont
forget about the need for a return or ground so lets make that:
dont we need just two wires?) True, two wires are used to transmit
information in one direction, but the other wires are used to
control the transmission.
- Slide 54
- CSIT 220 (Blum)54 Control pins The serial connector has pins.
Those that are not explicitly for data are known as control pins.
The control pins are used to negotiate the exchange of information.
Is the transmitting device ready? Is the receiving device ready?
Etc.
- Slide 55
- CSIT 220 (Blum)55 USB the new standard in town The development
of serial port standards was important in the development of
computers. Peripheral device developers knew that if they adhered
to the standards, users could add their device to the computer with
little trouble. Over the last few years Universal Serial Bus (USB)
ports and standards have taken over. Our purpose here is to
introduce some ideas about communication and standards. The USB
standards are somewhat more complicated, so the serial port
standards while they are becoming outmoded suit our purpose.
- Slide 56
- CSIT 220 (Blum)56 Some stray terminology Throughput: (like
bandwidth, but typically only used in reference to digital signals)
The rate at which data is transmitted or processed processed. Data
transfer rates for disk drives and networks are measured in terms
of throughput. Typically, throughputs are measured in kbps, Mbps
and Gbps. Bps bits per second
- Slide 57
- CSIT 220 (Blum)57 Some stray terminology (Cont.) Baud: the
number of signaling elements that occur each second. The term is
named after J.M.E. Baudot, the inventor of the Baudot telegraph
code. Since it is possible to encode more than one bit in each
electrical change, baud rates and bit rates need not be equal.
- Slide 58
- CSIT 220 (Blum)58 Other References http://www.webopedia.com
http://www.whatis.com http://www.m-w.com/
http://computer.howstuffworks.com/serial- port.htm/printable