Lecture 6 Serial Com Interface

28
Lecture 6 Serial Communic ation Intrerface 1 Communication Interface • RS-232/ RS-422/ RS-485 • USB • GPIB

Transcript of Lecture 6 Serial Com Interface

Page 1: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

1

Communication Interface

• RS-232/ RS-422/ RS-485• USB• GPIB

Page 2: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

2

Physical layer subdivision

mechanicalspecifications

electrical / opticalspecifications

medium-dependent signalling

medium-independent signallingsame for different media(e.g. coax, fibre, RS485)

applies to one media(e.g. optical fibres)

defines the mechanical interface(e.g. connector type and pin-out)

applies to one media type(e.g. 200µm optical fibres)

PhysicalLayer

Page 3: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

3

Concept relevant to physical layer

Topology

Mechanical

Control Send, Receive, Collision

Interface Binary bit, Collision detection [multiple access]Signal quality supervision, redundancy control

Modulation

Binary, NRZ, Manchester,..

Synchronisation Bit, Character, Frame

Flow Control Handshake

Medium

Channels

Coding/Decoding

Baseband, Carrier band, Broadband

Ring, Bus, Point-to-point

Connector, Pin-out, Cable, Assembly

signals, transfer rate, levels

Half-duplex, full-duplex, broadcast

Page 4: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

4

Generic Communication Interface Illustration

DTE DCE DCE DTE

Data Terminal Equipment

Data Communication Equipment

Data Terminal Equipment

Data Communication Equipment

Bit serial transmission lineSignal and control line

Signal and control line

Page 5: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

5

RS-232

• EIA’s Recommended Standard (RS)• Specifies electrical, mechanical, functional and

procedural aspects of the interface• Point-to-point connection• Widely used for connection of DTEs and DCEs and

many other applications.• Specifies signaling between DTE and DCEs.• Uses NRZ-L encoding

– Voltage less than -3V = logic “1”– Voltage greater than +3V = logic “0”

• Rated for less than 20 kbps and distance shorter than 15 meter. (greater rate and distance is theoretically possible, but not necessary wise)

Page 6: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

6

Voltage Level for EIA 232

Page 7: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

7

EIA 232 Transmitter and Receiver

Page 8: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

8

Common DB-9 and DB-25 Pin Assignment

Page 9: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

9

Serial Port Handshake• Connecting PC to an access server via a pair of

modems• Control / Status Lines (two straight-through cables)

– Data Terminal Ready indicates that PC is on and ready

– Data Set Ready indicates that modem is on and ready

– With Request to Send, PC tells modem to turn on its carrier

– With Clear to Send, the modem indicates that carrier is on

– With Data Carrier Detect, the modem indicates carrier seen

– With Ring Indicator, modem indicates incoming call

PC Modem Modem

DTRDSRRTSCTSDCD

GND

DTRDSRRTSCTSDCD

GND

RemoteAccessServerTXD

RXDTXDRXD

Analog signalson phone line

RI RI

Page 10: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

10

Serial Port Handshake• Connecting two PCs via a NULL modem cable

– Behaves like a pair of modems – Control / status lines are “cross-connected”– Transmit and receive data are “cross-connected”

TXDRXD

RTSCTSDCDGND

TXDRXD

RTSCTSDCDGND

DSR

(RI not normally needed)

DTRDSR

DTR

Page 11: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

11

Serial Port Handshake• Bits are sent on TXD and RXD serially (one at a time)

– Bit Rate needs to be specified– When the sequence starts and stops has to be

specified– How the bits are serialized has to be specified

Arbitrary time sincelast character sent

One Start Bit One or Two Stop Bits

D0 D1 D2 D3 D4 D5 D6 D7

ASCII character sentWith LSB first in time

OptionalParity Bit

-12V

+12VBit value = 0

Bit value = 1

Bit Duration = 1 / Bit Rate

Page 12: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

12

RS-232 DB-25 Connectors

DB-25 Female

DB-25 Male

Page 13: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

13

RS-232 DB-9 Connectors

Page 14: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

14

RS-232C (signal)

Odd Parity

Even Parity

No Parity

Page 15: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

15

RS-485

• Serial link in differential mode between two or several (max 32) DTE and DCE.

• Characteristics:– Logic level 0 : 0 / +5 V– Logic level 1 : +5 / 0 V– Rate : 10 Mbps– Max number of station : 32– Maximum cable length : 1200 M

Page 16: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

16

RS 485• The differential voltages on the A and B outputs of the driver

(transmitter) are similar (although not identical) to those for EIA-422, namely:

–1.5 V to –6 V on the A terminal with respect to the B terminal for a binary

1 (MARK or OFF) state, and

+1.5 V to +6 V on the A terminal with respect to the B terminal for a binary

0 (SPACE or ON state).• As with EIA-422, the line driver for the EIA-485 interface

produces a ±5 V differential voltage on two wires.• The major enhancement of EIA-485 is that a line driver can

operate in three states called tri-state operation:

Logic 1

Logic 0

High-impedance

Page 17: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

17

RS-485

DTE_1

T

R

DCE_1

ctrl

+

+ +

+

+

+

+

+

R

R

R

DCE_2

DTE_2

T

T

T

ctrl

ctrl

ctrl

Example: multipoint connection in half-duplex mode.

Page 18: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

18

Typical Two Wire Multidrop Network

Page 19: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

19

Typical Four Wire Multidrop Network

Page 20: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

20

EIA 422/ 485 Receiver Sensitivities

Page 21: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

21

Current Loop (4 to 20 mA)

• Serial connection between 2 or several (max 16) DTE and DCE.

• Characteristics:– Logic level 0 : I ≤ 4 mA

– Logic level 1 : 15 ≤ I ≤ 20 mA

– Rate : 20 Kbps– Max number of station : 16– Maximum cable length : 3700 M

Page 22: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

22

Current Loop (4 to 20 mA)

T

R

I1

I2 T R

DTE_1(sensor)

DTE_2(PLC)

Example : Point –to-point connection in half duplex mode. ( usually use for connection of sensors and PLC in a noisy environement)

Page 23: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

23

Current Loop (4 to 20 mA)

Page 24: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

24

USB-Universal Serial Bus• Widely use in PC.• USB enable “plug and play” connection to

several computer peripherals.– Human-Computer interface

• Mouse, keyboard, joystick, bar code reader etc

– Data storage devices• Hard disks, DC ROM

– Display unit• Monitor, printer, scanner, digital camera

– Communication device • Modem

Page 25: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

25

USB

• Peripheral without USB port such as PLC, microcontroller can be connected to a USB port at a PC through an adapter:– USB ↔ RS-232/ RS-485– USB ↔ IEEE 488/ Centronics– USB ↔ Internet interface 10BaseT-

100BaseTx

Page 26: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

26

USB - Connectors

Page 27: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

27

USB - Connectors• Each connector has four leads

– 2 leads for data (D+ and D -)– 2 leads for supply (Vbus and ground)

The wire comprise 2 twisted pair with metallic shield and its maximum length is 5 meters.

VBUS

GND

D +D -

Lead No Signal Color 1 VBUS (+5 V) Red 2 D - White 3 D + Green 4 GND Black

Page 28: Lecture 6 Serial Com Interface

Lecture 6 Serial Communication Intrerface

28

USB – transmission rate

• USB High speed = 480 Mbps (USB version 2.0)• USB Full speed = 12 Mbps (USB version

1.0)• USB Low speed = 1,5 Mbps (versions 1 ou 2)