c2-rs232-rs422-rs485-phan 1

Download C2-RS232-RS422-RS485-phan 1

Post on 03-Jun-2018

215 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    1/40

    1

    Serial CommunicationEIA RS232, RS422 and RS485

    Recommended Standard 232The purpose of this course note is to attempt to describe the main elements in SerialCommunication. This application note attempts to cover enough technical details ofRS232, RS422 and RS485.

    EI A - Electroonic Industries Association

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    2/40

    Must be a Sender and Receiver

    A protocol is a set of rules which governs the transfer of databetween computers. Protocols allow communication between

    computers and networks.

    Handshaking is used to establish which protocols to use.Handshaking controls the flow of data between computers

    Protocols will determine the speed of transmission, error checkingmethod, size of bytes, and whether synchronous or asynchronous

    Examples of protocols are: RS-232, TCP/IP, ....

    Characteristics of CommunicationSystems

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    3/40

    5 Basic ComponentsEvery communication system has 5 basic requirements Data Source (where the data originates) Transmitter (device used to transmit data) Transmission Medium (cables or non cable) Receiver (device used to receive data) Destination (where the data will be placed)

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    4/40

    5 Basic Components

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    5/40

    - simplex: One direction only

    Transmission Direction

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    6/40

    Half Duplex Transmission

    half duplex: Bothdirections but

    only onedirection at atime

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    7/40

    Full Duplex Transmission

    full duplex:send and

    receive bothdirections atonce

    RS232

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    8/40

    Analog ADC Line coding Digitaltransmission

    SamplingQuantizationCoding

    RZ, NRZ,AMI

    ASK,FSK,PSK

    Block diagram for digital transmission system

    Before any digital signal can be transmitted (viatransmission medium or wireless) it mustundergo line coding. What is line coding??

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    9/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    10/40

    PCM Procedures

    30 August 201310

    Pulse-amplitude modulation, acronym PAM, is a form of signal modulation where the messageinformation is encoded in the amplitude of a series of signal pulses.

    Sampled signal (discretesignal): discrete time,continuous values.

    Quantized signal: continuoustime, discrete values

    Digital signal (sampled,quantized): discrete time,

    discrete values.

    Quantization is the procedure of constraining something from a relatively large or continuousset of values (such as the real numbers) to a relatively small discrete set (such as the integers).

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    11/40

    Mch ly mu v gi

    - ly mu, cng tc c ng li trong mt khong thi gian t np n gi

    tr V in. Khi cng tc c nh ra, gi tr in th c gi nguyn. - Thi gian cng tc ng li (t ) c xc nh nh sau (trong khong thi gian ny, tc th np n 99% gi tr V in)

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    12/40

    nh l ly mu (tiu chun Nyquist)

    Tt c thng tin ca tn hiu gc c th c phc hi nu n c ly mu vi tn s(f s) ln gp t nht 2 ln tn s cao nht (f h) trong tn hiu gc.

    Thi gian ly mu:

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    13/40

    informationPCM

    Linecoder

    channel

    Reasons for linecoding:

    1. Synchronization2. Error detection

    3. Error correction

    The purpose of a line code is tomatch the output signal

    to the channel for basebandtransmission.

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    14/40

    drawbacks are that it is not self-clocking(Receiver Setting the clock matching the senders )

    Line Coding Unipolar encoding (NRZ)

    RZ encoding

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    15/40

    Digital Data Analog Signals

    Encoding is by modulation of a continuoussinusoidal carrier signal. This involvesalteration of some characteristics of thecarrier signal - amplitude, frequency, or phase.

    Various encoding techniques, ASK, FSK, PSK,...

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    16/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    17/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    18/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    19/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    20/40

    Time Division Multiplexing In time division, the communications link is subdivided in terms of time. Each sub-circuit is given the channel for a limited amount of time, before it

    is switched over to the next user, and so on In the picture bellow it can be seen that each sub-channel occupies the

    entire bandwidth of the channel, but only for a portion of the time

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    21/40

    Frequency Division Multiplexing In frequency division multiplexing, each sub-channel is

    separated by frequency (each sub-channel is allocated partof the bandwidth of the main channel)

    The speed or bandwidth of the main link is the sum of theindividual sub-channel speeds or bandwidth.

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    22/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    23/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    24/40

    Pulse Rate versus Bit Rate Pulse rate number of pulses per second Bit rate number of bits per second

    If pulse defines only one bit, Pulse rate and Bit rate are the same.

    If pulse defines more than one bit, Bit rate is greater than Pulse rate . Bit Rate = Pulse Rate x log 2 L

    L is the number of data levels of the signal.

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    25/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    26/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    27/40

    Parity

    The parity bit included at the end of the character to check for any error during

    transmission Even Parity : Total no. of bits including parity bit is Even Odd Parity : Total no. of bits including parity is Odd Only data bits and parity bit are considered for finding parity bit value. Example for Even parity : 0101 0101 0, total 4 ones Example for Odd parity : 0101 0101 1, total 5 ones

    Even Parity

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    28/40

    Graham Betts

    Any transmission May be: Analog or Digital Serial or Parallel

    Communication Concepts

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    29/40

    -Each bit has its own piece of wire along which it travels - Often used to send data to a printer

    Parallel Transmission

    All bits are sent simultaneously

    R e c e i v e r r e c e i v e

    d

    S e n d e r t r a n s m i t t e d

    10011

    001

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    30/40

    Sender transmitted

    Data is transmitted, on a single channel, one bit at atime one after another

    Receiver received

    Serial Transmission

    101 0 0 1 1 0

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    31/40

    Serial Transmission

    Shift Register

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    32/40

    Serial Transmission

    0 1 0 1 0 0 0 1 1 1

    Start bit

    Stop bit

    Asynchronous Communication

    Synchronous Communication

    1 0 1 0 0 0 1 1

    Clock

    Data

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    33/40

    Serial CommunicationName Sync

    /Async

    Type Duplex Max

    devices

    Max

    speed(Kbps)

    Max

    distance(feet)

    Pin

    count(not including ground)

    RS-232 async peer full 2 115.2 30 2 (or 4 with HW handshake)

    RS-422 async multi-drop half 10 10000 4,000 1 (unidirectional only,additional pins for each

    bidirectional comm.)

    RS-485 async multi-point half 32 10000 4,000 2

    I2C sync multi-master

    half Limitation basedon buscapacitance andbit rate

    3400 1000 625

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    34/40

    Serial Vs Parallel Communication System Comparison Data Transfer Speed

    Complexity and Cost of Serial and Parallel Interface

    Data Transfer Quality & Crosstalk Noise Interference

    High Frequency Performance

    Flexibility to Upgrade the Data CommunicationSoftware/Hardware What is the latest Trend? Serial or Parallel How to Choose the Best Data Transfer Interface from Serial

    or Parallel?

    Creating a parallel port relatively simple, requiring only a latch to copy data onto a data bus. In contrast, most serial communication must first be convertedback into parallel form by a universal asynchronous receiver/transmitter (UART) before they may be directly connected to a data bus. But in terms oftransmission channel costs such as data bus cable length, data bus buffers, interface connectors, area occupied on printed circuit board (PCB), the parallel datacommunication is somewhat costlier.

    Crosstalk creates interference between the parallel lines, and the effect worsens with the length of the communication link.

    Parallel buses are hard to run at high frequencies :1. It is hard to route many signals across a board without introducing timing variation (clock skew) betweenthem the more variation the lower maximum frequency is.2. Many wires switching simultaneously produce lots of EMI and interfere with each other. More EMI( ElectroMagnetic Interference ) leads to less maximum frequency.

    Speed of the parallel data transfer is extremely high compared to serial data transfer.

    Parallel data transfer mechanism more rely on hardwareresources and hence difficult and costlier.

    Parallel- short distance. Serial longer distance.Parallel- Low speed/frequency data transfer. Serial High speed/frequency data transfer.

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    35/40

    Data Transmission Signals

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    36/40

    RS232 Standard Interface between Data Terminal Equipment (DTE) and Data

    Communication Equipment (DCE) employing serial binary data

    interchanges. Logic 0 : +3V to 15 VDC Logic 1 : -3V to -15 VDC Maximum Distance : 15m or 50ft

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    37/40

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    38/40

    RS422 Standards The RS-422 standard defines a balanced (or differential) data communications

    interface using two separate wires for each signal. Due to the high noise immunity of the RS-422 standard, high data speeds and long

    distances can be achieved. The RS-422 specification allows reliable serial data communications for:

    Distances of up to 1200 meters Data rates of up to 10 Mbps 0 to +5V nominal signal swing

    RS-422 uses two separate twisted pairs and can be half or full duplex.

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    39/40

    RS485 Standards RS-485 interface has tri-state capability, so it can be used in multi-drop

    systems. RS-485 can be half or full duplex and has a 2- or 4-wire version. The 2-wire version uses a single twisted pair; the 4-wire version uses two

    twisted pairs. Each Slave device has a unique address and will only respond to requests

    from the Master. The Slave never initiates communication.

  • 8/12/2019 C2-RS232-RS422-RS485-phan 1

    40/40

    RS-485 can have multiple Commanding Devices and multipleListening Devices. RS-422 can have only one Commander andmultiple Listeners.