RS-232 (Serial Communication) and MAX-232
RS-232 (Serial Communication) and MAX-232
RS-232 (Serial Communication) and MAX-232
Costly
Serial Communication only requires 3 data lines But it transfers data, bit-by-bit
Types of Communication
There 3 types of communication Simplex Communication Duplex Communication
Simplex Communication
It is a unidirectional Communication
Data transfer occurs in one direction
both ends when one device sends data, other has to listen
Example: Walkie talkie
Protocols
A communications protocol is a system of digital
message formats and rules for exchanging those messages in or between computing systems An agreed-upon format for transmitting data between two devices A protocol may have a formal description Protocols may include signaling, authentication and error detection and correction capabilities
Protocols (cont)
Transmission Control Protocol (TCP)
User Datagram Protocol (UDP) Internet Control Message Protocol (ICMP)
RS-232
RS-232 (Recommended Standard-232) is a standard
interface approved by the Electronic Industries Association (EIA) for connecting serial devices.
RS-232 is the interface that your computer uses to talk
to and exchange data with your modem and other serial devices. The serial ports on most computers use a subset of the RS-232C standard.
RS-232 (cont)
There are two basic types of serial communications,: Synchronous Asynchronous
The serial ports on IBM-style PCs are asynchronous
Asynchronous Communication
Asynchronous means "no synchronization. The beginning and end of each byte of data must be
identified by start and stop bits. The start bit indicate when the data byte is about to begin and the stop bit signals when it ends. The requirement to send these additional two bits cause asynchronous communications to be slightly slower than synchronous. For example, a telephone conversation is asynchronous because both parties can talk whenever they like.
value of 1, (also called a mark state). By using this value to indicate that no data is currently being sent, the devices are able to distinguish between an idle state and a disconnected line. When a character is about to be transmitted, a start bit is sent. A start bit has a value of 0, (also called a space state). Thus, when the line switches from a value of 1 to a value of 0, the receiver is alerted that a data character is about to come down the line.
when a bit ends and new bit start. Suppose the line is low for some time that means a 0' but how many zeros? If we send data like 00001111 then line is first low for some time and high after that. Then how we know it is four '0's and four '1's?
Baud rate: The number of times per second that a line changes state. In Serial Communication Baud Rate and bit rate (bps) is
same
Example: 00001111 @ baud rate of 9600, means a bit will change in 1/9600=104 uS, if it takes 416 uS for 4 zeros and 416 uS for 1s then we can detect that there are four zeros and four ones.
Synchronous Communication
Synchronous communication requires that each end
respond in turn without initiating a new communication. The sender and receiver must synchronize with one another before data is sent. A typical activity that might use a synchronous protocol would be a transmission of files from one point to another. As each transmission is received, a response is returned indicating success or the need to resend.
initially synchronize themselves to each other, and then continually send characters to stay in sync. Synchronous communications allows faster data transfer rates than asynchronous methods, because additional bits to mark the beginning and end of each data byte are not required.
RS-232 Pins
9 pin # 3 2 7 8 6 4 1 25 pin# 2 3 4 5 6 20 8 Acronym TxD RxD RTS CTS DSR DTR DCD Full name Transmit Data Receive Data Request To Send Clear To Send Data Set Ready Data Terminal Ready Data Carrier Detect Direction -- --- ---- -Description Transmits bytes out of computer or device Receives bytes into computer or device RTS/CTS flow control RTS/CTS flow control This device is ready to communicate This device is ready to communicate Modem connected to another Ringing on telephone line
9
5
22
7
RI
SG
Ring Indicator
Signal Ground
--
Baud Rates
As there is no "clock" line so for synchronization accurate
timing is required so transmissions are carried out with certain standard speeds. The speeds are measured in bits per second. Number of bits transmitted is also known as baud rate. Some standard baud rates are
Null Modem
Null modem is a communication method to connect
of the two ends of the communications link so it assumes that one end is a DTE and the other is a DCE e.g. a modem. With a null modem connection the transmit and receive lines are cross-linked. Depending on the purpose, sometimes also one or more handshake lines are crosslinked. Several wiring layouts are in use because the null modem connection is not covered by a standard.
Ringing.
RS-232 Protocol
RS 232 Voltage levels -3 to -25 (Logic HIGH) +3 to +25 (Logic LOW) Data bit sequence IDEAL (Logic HIGH) Start bit (Logic LOW) First bit as LSB (B0) . . . 8th bit as MSB (B7) Parity bit (if pre-set in settings) Stop bits (can be 1 or 2 depends on settings)
from each transmitter, Since due to cable resistance the voltage reduces the further the signal has to travel.
MAX-232
MAX-232 converts RS-232 Voltage levels to make it
compatible with TTL Logic. The MAX232 inverts and shifts the level so that idle become high (+5V) and the start bit is low (0V). MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single + 5 V supply via onchip charge pumps and external capacitors. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard +5V TTL levels
RS232 Voltage
+3 V to +15 V -3 V to -15 V -3 V to -15 V
+3 V to +15 V
0V
MAX-232 Pins
Interfacing with uC
References
References
http://www.electronics-tutorials.ws/logic/logic_1.html
http://www.petervis.com/electronics%20guides/MAX
232/MAX232.html