RS232 – Basics, Applications and Interfacing

What is RS232?

The RS-232(X) is a serial communication protocol, commonly used for transferring and receiving the serial data between two devices.  It supports both synchronous and asynchronous data transmissions. Many devices in the industrial environment are still using RS-232 communication cable. Rs-232 cable is used to identify the difference of two signal levels between logic 1 and logic 0. The logic 1 is represented by the -12V and logic 0 is represented the +12V.  The RS-232 cable works at different baud rates like 9600 bits/s, 2400bits/s, 4800bits/s etc. The RS-232 cable has two terminal devices namely Data Terminal Equipment and Data communication Equipment. Both devices will send and receives the signals. The data terminal equipment is a computer terminal and data communication Equipment is modems, or controllers etc.

The General RS-232 Communication Diagram

Now a day’s most of the personal computers have two serial ports and one parallel port (RS232). These two types of ports are used for communicating with external devices and they work in different ways. The parallel port sends and receives the 8-bit data at a time over eight separate wires and this transfers the data very quickly, the parallel ports are typically used to connect a printer to a PC.

A serial port sends and receives one-bit data at a time over one wire and it transfers data very slowly. The RS-232 stands for recommended slandered and 232 is a number X indicates the latest version like RS-232c, RS232s.

The most commonly used type of serial cable connectors are 9-pin connectors DB9 and 25-pin connector DB-25. Each of them may be a male or female type. Nowadays most of the computers use the DB9 connector for asynchronous data exchange. The maximum length of RS-232 cable is 50ft.

RS-232 Communication Cable

RS232 Pin Description

RS-232 cable 25 Pin connector

It is a 25-pin connector, each pin has its own function is as follows.

PIN 1: (Protective Ground); It is a ground Pin.

PIN 2: Transmit Data.

PIN 3: Receive Data.

PIN 2 & PIN 3: These pins are most important pins for data transmitting and receiving. The 1 & 2-pins are used to data transmission and pin-3 used to data receiving purpose.

PIN 4: Request to send.

Pin 5: Clear to send.

PIN 6: Data Set Ready.

PIN 20: Data terminal Ready.

PIN 4, PIN 5, PIN 6, PIN 20: These pins are the handshaking pins(flow of control). Normally terminals cannot transmit the data until clear to send transmission is received from the DCE.

PIN 7: This pin is the common reference for all signals, including data, timing, and control signals. The DCE and DTE work properly across the serial interface and the pin-7 must be connected both ends without interface would not work.

PIN 8: This pin is also known as received line signal detect or carrier detect. This signal is activated when a suitable carrier is established between the local and remote DCE devices.

PIN9: This pin is a DTE serial connector, this signal follows the incoming ring to an extent. Normally this signal is used by DCE auto answer mode.

PIN 10: Test Pin.

PIN 11: standby select.

PIN 12: Data Carrier Detect.

PIN 13: Clear to send.

PIN 14: Transmit data.

PIN 15: Transmit clock.

PIN 17: Receive clock.

PIN 24: External Clock.

PIN 15, 17, 24; Synchronous modems use the signals on these pins. These pins are controlled bit timing.

PIN 16:  Receive data.

PIN 18: Test Pin.

PIN 19: Request to send.

PIN 21: (Signal Quality Detector); This pin Indicates the quality of the received carrier signal because the transmitting modem must be sent 0 or either 1 at each bit time, the modem controls the timing of the bits from the DTE.

PIN 22: (Ring Indicator): The ringing indicator means the DCE informs the DTE that the phone is ringing. All the modems designed for directly connected to the phone network equipped with auto answer.

PIN 23: Data Signal Rate Detector

Application of RS232

RS-232 cable interface Diagram

The Auto shutdown feature is intended to save power. The RS-232 is placed to work in the low power shutdown mode.  The system will shutdown whenever the RS-232 device is not used. The auto shutdown pulse will shut itself down whenever there is not any activity on the signal for 30sec. It means that whenever a transceiver is connected to the RS-232 port but it is not sending data. The Pin 2 and Pin 3 are used for transmitting and receiving the data. The Pin 5 is used to connect to ground. The Max 232 device is used to communicate with the DTE and DCE devices through RS-232 cable.

The first auto shutdown pulse monitors both receiver and transmitter activity. Both activities are stable and the system goes to sleep mode or shutdown mode. The most of devices that use RS-232 cable are CPS and laptops.

Interfacing RS232 to Microcontrollers using Max 232

Max 232 – The Level Shifter IC for PC Interface

Max 232 acts as a buffer driver for the processor. It accepts the standard digital logic values of 0 & 5 volts and converts them to the RS232 standard of +10 & -10 volts. Few Microcontrollers have built in serial ports which allow for direct connection with the RS232 serial port of the PC. However many microcontrollers give a 0 to 5V output and require a intermediate buffer circuit to convert the 0 to 5 volts to +10 and -10V required by the RS232 port.

The Max 232 IC consists of two transmitter-receiver arrangement such that two serial ports can be connected using the same chip. 5 capacitors of each 1microFarad are used to generate the required RS232 standard voltage from the TTL/CMOS voltage. The transmitters convert the TTL/CMOS level to RS232 level whereas the receiver receives the RS232 input and converts them to TTL level voltage.

It is basically a 16 pin IC with the transmitter pins connected to the microcontroller and the port such that the input transmitter pin get TTL input from the Microcontroller and the output transmitter pin supply  output to the RS232 port. The receiver pins are connected to the RS232 port such that the input receiver pin receive RS232 standard input from the PC port and the output receiver pin supplies the TTL input to the Microcontroller. Thus the transmitter takes input from the Microcontroller and gives output to the RS232 port whereas the receiver takes input from the RS232 port and gives output to the Microcontroller.  The other pins are connected to 5 electrolyte capacitors such that one of the capacitors is used as a voltage doubler to get +10V from 5Vs and another capacitor is used as a voltage inverter to get -10V and the other three capacitors are used as bypass capacitors for Vcc, V+ and V- pins respectively. Thus the capacitors act as voltage generators.

One of the basic advantages of Max 232 is that it operates with a 5V supply, which allows for a single 5V supply to be used for both the IC and the Microcontroller.

Max 232 Pin Diagram and Circuit Diagram

MAX 232

Pin Diagram and Internal Schematic

Features of Max232 IC

  • Input supply voltage of 5V.
  • Input voltage levels compatible with TTL standard.
  • Output voltage levels compatible with RS 232 standard.
  • Low input current of 0.1microAmpere and output current of 24mA.
  • It operates in a temperature range of -40 degree Celsius to +85 degree Celsius

Application of Max 232

Typical applications of Max232 involve modems, computers, RS232 systems and terminals. For a typical working application involving Max 232 as a intermediate between the Microcontroller and the RS 232 connected to the Computer, one of the transmitter input pins receive TTL input from the Microcontroller and the capacitor arrangement obtains the +/-10V signal which is applied to the corresponding transmitter output pin, given to the RS232 port.

The receiver input pin receives 232 standard input from the RS232 port and accordingly the corresponding receiver output pin gives the TTL standard output to the Microcontroller. Thus the Max 232 IC can be used as an intermediate connection between Microcontroller and a Computer.

Photo Credit:

One Comment

  1. Looking for this article, Thank you!!!!

Add Comment