rs232 communication

21
RS232 COMMUNICATION

Upload: arun

Post on 10-Apr-2016

41 views

Category:

Documents


3 download

DESCRIPTION

RS232

TRANSCRIPT

Page 1: Rs232 Communication

RS232 COMMUNICATION

Page 2: Rs232 Communication

Introduction

• Full name is RS-232-C • RS-232 defines serial, asynchronous communication • RS-232 is a popular communications interface for connecting

modems and data acquisition devices• RS-232 can be plugged straight into the computer’s serial port

(know as COM or Comm port).• Architecturally RS-232 is a bi-directional point to point link.

Page 3: Rs232 Communication

Port Details

• Architecturally RS-232 is a bi-directional point to point link also it specifies the use of “start” and “stop” bits.

• Logical 1 is -15Vdc• Logical 0 is +15Vdc

Page 4: Rs232 Communication

RS232

• One important aspect of RS-232 is that it is an asynchronous form of communication.

• Asynchronous communication is important because it is efficient; if no data needs to be sent, the connection is “idle.” No additional CPU overhead is required for an idle serial line.

• RS-232 is a standard by which two serial devices communicate• The connection must be no longer than 50 feet • Transmission voltage are -15V and + 15V• It is designed around transmission of characters of 7 bits of

length.

Page 5: Rs232 Communication

Type of Communication

Page 6: Rs232 Communication

Serial Communications

• Serial communication, as the name implies, occurs in serial form through simple, twisted-pair cables.

• It allows peripheral equipment, such as terminals, modems, operator

interface panels, and line printers, to receive ASCII information.

Page 7: Rs232 Communication

Types of data transfer

• Unidirectional or Bidirectional• Unidirectional : One device is Sender (Output Device) and another

is Receiver (Input Device)• Bidirectional : Both devices can work as either Sender or Receiver

(Input or Output)• Bidirectional is done using single line shared between two devices• Two different lines are used one for receiving and other for

transferring with respect to one device.• First is known as Half Duplex• Second type is known as Full Duplex• Synchronous(no start &stop bits) and asynchronous(start bit before

the byte and stop bit at the end of bit) type data transfer.

Page 8: Rs232 Communication

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

Page 9: Rs232 Communication

Need of Parity Bit

• 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

Page 10: Rs232 Communication

Parity

Page 11: Rs232 Communication

Baud Rate

• The UART is also responsible for baud rate generation. This determines the speed at which data is transmitted and received.

• One baud is one bit per second (bps). As of this writing, data rates can reach up to 230,400 baud.

• The cable length between devices is limited by the baud rate -- the higher the speed, the shorter the cable.

• The RS-232C standard only permits transmission speeds up to 19200 baud with a cable length of 45 feet. With modern UARTs, 230,400 baud can be achieved with a short cable length of a few feet.

Page 12: Rs232 Communication

Baud Rate Range

• RS232 works in a restricted range of baud rates: 75, 110, 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 33600, 56000, 115200 and 230400.

• Start Bits 1• Stop Bits 1, 11/2 or 2• Data Bits 5, 6, 7, 8• Parity Bits Even, odd or none

• Instruction cycle is the machine instruction executed each clock cycle• SMOD is the normal/double baud rate bit.• TRV is the reload value for the timer

Page 13: Rs232 Communication

Baud Rate v/s Data Transfer Rate

• Data transfer rates are measured in bits per second (bps). • This is an indication of the useful data that has been transmitted

from the transmitter to the receiver. • For example, in Figure the useful data is only Eight bits, whilst

the total number of bits (or signal changes) amounts to Twelve. • The additional Four bits are overhead bits.

• Baud rate: The number of signal changes per second, irrespective of the presence of any useful data in the bit stream

Page 14: Rs232 Communication

Limitations

• Large-amplitude, bipolar voltage swings complicate power supply and driver design

• Non-differential signaling limits noise immunity Cable length typically limited to 15m, more with low-

capacitance cables. • Slower than modern serial interfaces, such as USB .• No standard way to connect more than two devices on one bus

Page 15: Rs232 Communication

What is a Bit Rate

• Number of bits that can be transmitted in 1 second.• If tp is the duration of the bit then the Bit rate R= 1/tp.• Bit duration need not be same as the pulse duration.

Page 16: Rs232 Communication

Received &Transmitted signals

• Received Signal is never same as transmitted.• Clock signal samples & regenerates the original bits as it was

transmitted.• Received Signal should be sampled at right instant. Otherwise it will

cause bit error.• Transmitted Signal also

Page 17: Rs232 Communication

Data Speed, Baud

• Two units of speed are employed in data transmission.• Number of data bits transmitted per second (BPS)• Baud : the rate at which the signal changes• For a binary two-level signal, a data rate of one bit per second is

equivalent to one Baud.

Page 18: Rs232 Communication

Transmission Speed

• In RS-232, each signal change represents one bit, so baud rate and bits per second are equal

• Since each 8 bits of data are accompanied by a start and stop bit, max. data rate is only 8/10 of baud rate

• The final sample is taken 9.5 bit periods after the initial falling edge and must lie within the stop bit

• The permissible error is therefore about ±0.5 bit period in 9.5 periods or ±5%

• There may be errors in both receiver and transmitter, so each should be accurate to within about ±2%

Page 19: Rs232 Communication

Transmission Format

Every time a character is sent, the same communication occurs:• Start bit sent.• Seven data bits sent.• Stop bit sent.• This communication is dependent on the fact that both devices are

sampling the bits at the same rate.s

Page 20: Rs232 Communication

Line Sampling & Framing

• RS-232 hardware samples the line multiple times during a single bit transmission.

• If the samples do not all have the same voltage, a framing error occurs.

• A framing error should only occur if one device is sending faster than the other device is set to receive.

• An intentional frame error can be caused by sending a BREAK.

Page 21: Rs232 Communication

Continue..,

• However, serial communications between devices also has its own speed barrier.

• RS-232 was designed with the understanding that the analog world is far from perfect.

• Digital is fast, analog is slow. RS-232 is analog, therefore is it slow (in computing terms).

• Signal noise is bad. It is caused by a variety of sources, all of which lead to lower speeds and less reliable transmission.