1 Fall 2005 Local Serial Asynchronous Communication Qutaibah Malluhi Computer Science and Engineering Qatar University
Dec 31, 2015
1
Fall 2005
Local Serial Asynchronous Communication
Qutaibah MalluhiComputer Science and Engineering
Qatar University
2
Bit-wise data transmission
Data transmission requires: – Encoding bits as energy – Transmitting energy through medium – Decoding energy back into bits
Energy can be electric current, radio, infrared, light
Transmitter and receiver must agree on encoding scheme and transmission timing
3
Using Electric Current to Send Data
Simple idea - use varying voltages to represent 1s and 0s
One common encoding use negative voltage for 1 and positive voltage for 0
In following figure, transmitter puts positive voltage on line for 0 and negative voltage on line for 1
4
Encoding Details and Standards
Encoding scheme must specify the details. For example: – How long will voltage last for each bit? – How soon will next bit start? – How will the transmitter and receiver agree on timing?
All details specified by standards Allow interoperability of devices adhering to the
standard Several organizations produce networking
standards» International Telecommunications Union (ITU) » Electronic Industries Association (EIA) » Institute for Electrical and Electronics Engineers (IEEE)
5
Types of Data Transmission
6
Parallel versus Serial Transmission
Parallel
Serial
7
Asynchronous Communication
Asynchronous and synchronous communications In broad sense, communication may be called
asynchronous if transmitter and receiver do not explicitly coordinate before each data transmission – Sender can wait arbitrarily long between transmissions.
Sends when data becomes ready– Used, for example, when sender may not always have
data ready to send (E.g., keyboard, mouse) – Receiver does not know when a character will arrive.
May wait forever In more technical sense, Asynchronous may also
mean no explicit information about where individual data bits begin and end
8
Asynchronous Vs. Synchronous
Synchronous:– May use a separate
clock signal to indicate duration of bits.
Asynchronous– How do we know beginning of a bit and the ending of
it?– One way to ensure meaningful exchange
» Sender and receiver agree on bit duration» Start bit before character» One or more stop bits after character» 1s when idle
Line idle 0 1 1 0 1 0 1
Clock
Data
e.g., 010100110100110101110011010111111111 Ch1 Ch2
Ch3 Idle
9
Asynchronous Transmission
10
The RS-232C Standard
Standard specified by EIA For transfer of characters across copper wire Full name is RS-232-C common name is RS-232 Defines serial, asynchronous communication
– Serial - bits are encoded and transmitted one at a time (as opposed to parallel transmission)
– Asynchronous - characters can be sent at any time and bits are not individually synchronized
11
More Details about RS-232
Components of standard: – Data represented by voltage between +15 and –15– Cable limited to ~50 feet– 25-pin connector, with specific signals such as data,
ground and control assigned to designated pins – Specifies transmission of characters between, e.g., a
terminal and a modem Transmitter never leaves wire at 0v; when idle,
transmitter puts negative voltage (a 1) on the wire
12
RS-232 Character Transmission
Transmitter indicates start of next character by transmitting a zero – Receiver can detect transition as start of character – Extra zero called the start bit
Transmitter must leave wire idle so receiver can detect transition marking beginning of next character – Transmitter sends a one after each character – Extra one called the stop bit
Thus, character represented by 7 data bits requires transmission of 9 bits across the wire
RS-232 terminology: MARK is a negative voltage (== 1) SPACE is a positive voltage (== 0)
13
Duration of a Bit
Transmitter and receiver must agree on timing of each bit
Agreement accomplished by choosing transmission rate – Measured in bits per second – Detection of start bit indicates to receiver when
subsequent bits will arrive Hardware can usually be configured to select
matching bit rates – Switch settings – Software
– Autodetection
14
Bit Rate And Baud Rate
Baud rate measures number of signal changes per second
Bits per second measures number of bits transmitted per second
In RS-232, each signal change represents one bit, so baud rate and bits per second are equal
If each signal change represents more than one bit, bits per second may be greater than baud rate– Bit rate = Baud rate * the number of bits represented by
each signal unit– Example: An analog signal carries 4 bits in each signal
change. If 1000 signal changes are sent per second, then baud rate = 1000 bauds per second,
bit rate = 1000 * 4 = 4000 bps
15
Character Framing
Start and stop bits represent framing of each character
If transmitter and receiver are using different speeds, stop bit will not be received at the expected time
Problem is called a framing error RS-232 devices may send an intentional framing
error called a BREAK – E.g., ASCII keyboard BREAK key– Deliberately create a framing error. Applications
noticing a framing error as a request to abort
16
Full-Duplex Communication
Simultaneous two-way communication Requires each side to have transmitter and receiver Requires an electrical path in each direction
Transmitter on one side connected to receiver on other
Separate wires needed to carry current in each direction
Common ground wire
17
DB-25 Connection Standard
RS-232 specifies use of 25 pin connector (DB-25)
Pins are assigned for use as data, ground and control: – Pin 2 - Receive (RxD) – Pin 3 - Transmit (TxD) – Pin 4 - Ready to send
(RTS) – Pin 5 - Clear to send
(CTS) – Pin 7 – Ground
Commonly DB-9 is used.
18
2-3 Swap
Cable must cross-over wires to connect pins 2 and 3 on receiver and transmitter
RS-232 specifies that modems (DTE) transmit on pin 2 and receive on pin 3, while computers (DCE) transmit on pin 3 and receive on pin 2– DTE: Data Terminal Equipment (modem)– DCE: Data Computer Equipment (computer)
To connect two DCEs (Computers), RS-232 cables between two computers must have 2-3 swap– Also called null modem cable
To connect DCE to DTE, use a straight through cable– Standard modem cable
19
Electric Transmission
In real world– Electric energy dissipates as it travels along– Wires have resistance, capacitance, and inductance
which distort signals– Magnetic or electrical interference distorts signals– Distortion can result in loss or misinterpretation
20
Distorted Signal For A Single Bit
In practice– Distortion can be much worse than illustrated
21
Consequences
RS-232 hardware must handle minor distortions– Take multiple samples per bit– Tolerate less than full voltage
Can not use electrical current for long-distance transmission– Use carrier signals
22
Newer Standards
USB (Universal Serial Bus)– Hot pluggable– Device powered by bus– Upto 12 Mbps – Newer USB2 speed is 480 Mbps
Firewire: a high speed serial bus– 400/800 Mbps
23
Conclusions
Asynchronous communication - data can start at any time; individual bits not delineated
RS-232 - EIA standard for asynchronous character transmission
Bit rate and baud rate Bandwidth limits maximum data transmission
rate Newer standards such as USB and Firewire are
replacing the role of RS 232 in PCs