+ All Categories
Home > Documents > RS-232 (Local Asynchronous Communication)

RS-232 (Local Asynchronous Communication)

Date post: 05-Feb-2016
Category:
Upload: azia
View: 55 times
Download: 0 times
Share this document with a friend
Description:
RS-232 (Local Asynchronous Communication). Based on Chapter 5 in Computer Networks and Internets by D. Comer. 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. - PowerPoint PPT Presentation
Popular Tags:
58
CSIT 220 (Blum) 1 RS-232 (Local Asynchronous Communication) Based on Chapter 5 in Computer Networks and Internets by D. Comer
Transcript
Page 1: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 1

RS-232 (Local Asynchronous Communication)

Based on Chapter 5 in Computer Networks and Internets by D. Comer

Page 2: RS-232 (Local Asynchronous Communication)

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.

Page 3: RS-232 (Local Asynchronous Communication)

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

Page 4: RS-232 (Local Asynchronous Communication)

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.

Page 5: RS-232 (Local Asynchronous Communication)

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

Page 6: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 6

Page 7: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 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.

Page 8: RS-232 (Local Asynchronous Communication)

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).

Page 9: RS-232 (Local Asynchronous Communication)

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

Page 10: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 10

Page 11: RS-232 (Local Asynchronous Communication)

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).

Page 12: RS-232 (Local Asynchronous Communication)

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.

A B C

Different times between character transmissions

Page 13: RS-232 (Local Asynchronous Communication)

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.

A B C D E F G H I J K

Page 14: RS-232 (Local Asynchronous Communication)

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.

Page 15: RS-232 (Local Asynchronous Communication)

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.

• (It’s possible to buffer the keyboard input before transmitting it to the computer.)

Page 16: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 16

Beginning, middle and end

• Synchronous and asynchronous both have – Beginning: I’m sending you data– Middle: the actual data– End: I’m done

• Overhead: the percentage of information that is not actual data

Overhead =Beg+End

100%Beg + Mid + End

Page 17: RS-232 (Local Asynchronous Communication)

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

Page 18: RS-232 (Local Asynchronous Communication)

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.

A B C

More restrictive than asynchronous, less restrictive than synchronous.

Page 19: RS-232 (Local Asynchronous Communication)

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).

Page 20: RS-232 (Local Asynchronous Communication)

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.

Page 21: RS-232 (Local Asynchronous Communication)

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.

Page 22: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 22

Minimizing noise

• One way to reduce noise is to reduce a signal’s 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!

Page 23: RS-232 (Local Asynchronous Communication)

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.

Page 24: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 24

The competition

• The competition between speed and accuracy can be seen in the theorems of Nyquist and Shannon-(Hartley).

• Nyquist’s theorem tells one how to send information faster.

• But Shannon’s theorem tells how that speed is ultimately limited by noise.

Page 25: RS-232 (Local Asynchronous Communication)

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.

Page 26: RS-232 (Local Asynchronous Communication)

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 = log2(Number of States)– Logarithmic

Page 27: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 27

A bit on logarithms (Cont.)• Log2(1) = 0

• Log2(2) = 1

• Log2(4) = 2

• Log2(8) = 3

• Log2(16) = 4

• Log2(32) = 5

• Log2(64) = 6

• Log2(128) = 7

• Log2(256) = 8

• Log2(512) = 9

• Log2(1024) = 10

• Log2(2048) = 11

• Log2(4096) = 12

• Log2(8192) = 13

• Log2(16384) = 14

• Etc.

Page 28: RS-232 (Local Asynchronous Communication)

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.

Page 29: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 29

Nyquist’s theorem

• D = (2) B Log2 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.

Page 30: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 30

The problem with higher frequencies• D = (2) B Log2 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).

Page 31: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 31

K= 2 two bits per cycle

-1

-0.5

0

0.5

11

0

0

1

0

1

0

0

One cycle

2 possible amplitudes

Page 32: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 32

K= 4 four bits per cycle

-1

-0.5

0

0.5

1 11

01

00

00

01

10

01

01

4 possible amplitudes.

Page 33: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 33

More levels less room for error

0

0.25

0.5

0.75

1

0

0.25

0.5

0.75

1

Page 34: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 34

More levels less room for error

• D = (2) B Log2 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 Shannon’s theorem places a limit on Nyquist’s.

Page 35: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 35

K=2 with some noise

-1

-0.5

0

0.5

1

Page 36: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 36

K=4 with some noise

-1

-0.5

0

0.5

1

-1

-0.5

0

0.5

1

Page 37: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 37

Shannon’s theorem

• C = B Log2 (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.

Page 38: RS-232 (Local Asynchronous Communication)

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 signal’s strength (power) relative to the background noise.

Page 39: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 39

Decibels• Sometimes the signal-to-noise ratio is reported in

decibels (S/N)in decibels = 10 Log10 (S/N)

When using Shannon’s 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.

Page 40: RS-232 (Local Asynchronous Communication)

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.

Page 41: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 41

Fig. 5-1 A possible approach: bit-at-a-time

Page 42: RS-232 (Local Asynchronous Communication)

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, there’s 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 1’s.

• And while keyboard data is intermittent, it does tend to come in bytes instead of bits.

Page 43: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 43

Fig. 5.2 Framing a group of bits: a byte-

plus-at-a-time

Page 44: RS-232 (Local Asynchronous Communication)

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.

Page 45: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 45

Rules• In order to distinguish between two

consecutive 1’s, 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 1’s.

• Since the signal is asynchronous, we also need to distinguish between no signal and a signal of all 1’s.

Page 46: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 46

Frame

• All 1’s is distinguished from no signal in that all 1’s 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.

Page 47: RS-232 (Local Asynchronous Communication)

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.

Page 48: RS-232 (Local Asynchronous Communication)

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.

Page 49: RS-232 (Local Asynchronous Communication)

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.)

Page 50: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 50

Serial ports

Page 51: RS-232 (Local Asynchronous Communication)

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).

Page 52: RS-232 (Local Asynchronous Communication)

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.

Page 53: RS-232 (Local Asynchronous Communication)

CSIT 220 (Blum) 53

Why so many pins?

• If we are sending information a bit at a time, don’t we need just one wire?

• (Don’t forget about the need for a return or ground – so let’s make that: don’t 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.

Page 54: RS-232 (Local Asynchronous Communication)

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.

Page 55: RS-232 (Local Asynchronous Communication)

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.

Page 56: RS-232 (Local Asynchronous Communication)

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

Page 57: RS-232 (Local Asynchronous Communication)

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.

Page 58: RS-232 (Local Asynchronous Communication)

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


Recommended