Serial Programming/MAX232 Driver Receiver - Wikibooks, open books for an open world
Driver on

Serial Programming/MAX232 Driver Receiver – Wikibooks, open books for an open world

MAX232 twin transmitter / twin receiver RS-232 chip in DIP-16 bundle

Applicability[edit]

This module is major of curiosity for individuals constructing their very own electronics with an RS-232 interface.
Off-the-shelf computer systems with RS-232 interfaces already include the mandatory electronics, and there’s no want so as to add the circuitry as described right here.

Introduction[edit]

Logic Sign Voltage[edit]

Serial RS-232 (V.24) communication works with voltages (between -15 V … -3 V are used to transmit a binary ‘1’ and +3 V … +15 V to transmit a binary ‘0’) which aren’t appropriate with at the moment’s pc logic voltages. Then again, traditional TTL pc logic operates between 0 V … +5 V (roughly 0 V … +0.8 V known as low for binary ‘0’, +2 V … +5 V for excessive binary ‘1’ ). Trendy low-power logic operates within the vary of 0 V … +3.3 V and even decrease.

So, the utmost RS-232 sign ranges are far too excessive for at the moment’s pc logic electronics, and the adverse RS-232 voltage cannot be generated in any respect by the pc logic. Due to this fact, to obtain serial knowledge from an RS-232 interface the voltage must be diminished, and the 0 and 1 voltage ranges inverted. Within the different course (sending knowledge from some logic over RS-232) the low logic voltage must be “bumped up”, and a adverse voltage must be generated, too.

     RS-232              TTL             Logic
-----------------------------------------------
 -15 V ...  -3 V  <->  +2 V ... +5 V    <->  1   (idle state)
  +3 V ... +15 V  <->   0 V ... +0.8 V  <->  0   (begin bit)

All this may be achieved with standard analog electronics, e.g. a selected energy provide and a few transistors or the as soon as well-liked MC1488 (transmitter) and MC1489 (receiver) ICs. Nonetheless, since greater than a decade it has turn into customary in newbie electronics to do the mandatory sign stage conversion with an built-in circuit (IC) from the MAX232 household (usually a MAX232A or some clone). In reality, it’s onerous to seek out some RS-232 circuitry in newbie electronics with no MAX232A or some clone.

We talk about the sign bits in additional element later on this e book.

MAX232 and MAX232A[edit]

A MAX232 built-in circuit

The MAX232 from Maxim was the primary IC which in a single bundle accommodates the mandatory drivers (two) and receivers (additionally two), to adapt the RS-232 sign voltage ranges to TTL logic. It turned well-liked, as a result of it simply wants one voltage (+5 V) and generates the mandatory RS-232 voltage ranges (approx. -10 V and +10 V) internally. This significantly simplified the design of circuitry. Circuitry designers now not must design and construct an influence provide with three voltages (e.g. -12 V, +5 V, and +12 V), however may simply present one +5 V energy provide, e.g. with the assistance of a easy 78×05 voltage regulator.

The MAX232 has a successor, the MAX232A. The ICs are nearly similar, nonetheless, the MAX232A is way more usually used (and simpler to get) than the unique MAX232, and the MAX232A solely wants exterior capacitors 1/10th the capability of what the unique MAX232 wants.

It must be famous that the MAX232(A) is only a driver/receiver. It doesn’t generate the mandatory RS-232 sequence of marks and areas with the proper timing, it doesn’t decode the RS-232 sign, it doesn’t present a serial/parallel conversion. All it does is to transform sign voltage ranges. Producing serial knowledge with the proper timing and decoding serial knowledge must be achieved by further circuitry, e.g. by a 16550 UART or one among these small micro controllers (e.g.
Atmel AVR,
Microchip PIC) getting an increasing number of well-liked.

The MAX232 and MAX232A have been as soon as slightly costly ICs, however at the moment they’re low cost. It has additionally helped that many corporations now produce clones (ie. Sipex). These clones typically want totally different exterior circuitry, e.g. the capacities of the exterior capacitors range. It is strongly recommended to test the information sheet of the actual producer of an IC as an alternative of counting on Maxim’s unique knowledge sheet.

The unique producer (and now some clone producers, too) gives a big collection of comparable ICs, with totally different numbers of receivers and drivers, voltages, built-in or exterior capacitors, and many others. E.g. The MAX232 and MAX232A necessity exterior capacitors for the inner voltage pump, whereas the MAX233 has these capacitors built-in. The MAX233 can also be between three and ten occasions dearer in digital retailers than the MAX232A due to its inside capacitors. It is usually harder to get the MAX233 than the backyard selection MAX232A.

An analogous IC, the MAX3232 is these days obtainable for low-power 3 V logic.

MAX232(A) DIP Bundle

MAX232 Pinout.svg

MAX232(A) DIP Bundle Pin Structure
Nbr Identify Function Sign Voltage Capacitor Worth MAX232 Capacitor Worth MAX232A
1 C1+ + connector for capacitor C1 capacitor ought to stand at the least 16 V 1 µF 100 nF
2 V+ output of voltage pump +10 V, capacitor ought to stand at the least 16 V 1 µF to VCC 100 nF to VCC
3 C1- – connector for capacitor C1 capacitor ought to stand at the least 16 V 1 µF 100 nF
4 C2+ + connector for capacitor C2 capacitor ought to stand at the least 16 V 1 µF 100 nF
5 C2- – connector for capacitor C2 capacitor ought to stand at the least 16 V 1 µF 100 nF
6 V- output of voltage pump / inverter -10 V, capacitor ought to stand at the least 16 V 1 µF to GND 100 nF to GND
7 T2out Driver 2 output RS-232
8 R2in Receiver 2 enter RS-232
9 R2out Receiver 2 output TTL
10 T2in Driver 2 enter TTL
11 T1in Driver 1 enter TTL
12 R1out Receiver 1 output TTL
13 R1in Receiver 1 enter RS-232
14 T1out Driver 1 output RS-232
15 GND Floor 0 V 1 µF to VCC 100 nF to VCC
16 VCC Energy provide +5 V see above see above

V+(2) can also be related to VCC through a capacitor (C3). V-(6) is related to GND through a capacitor (C4). And GND(15) and VCC(16) are additionally related by a capacitor (C5), as shut as potential to the pins.

A Typical Software[edit]

RS-232 to TTL converters, utilizing MAX232

The MAX232(A) has two receivers (converts from RS-232 to TTL voltage ranges) and two drivers (converts from TTL logic to RS-232 voltage ranges). This implies solely two of the RS-232 alerts may be transformed in every course. The previous MC1488/1489 combo supplied 4 drivers and receivers.

Usually a pair of a driver/receiver of the MAX232 is used for

and the second for

There usually are not sufficient drivers/receivers within the MAX232 to additionally join the DTR, DSR, and DCD alerts. Normally these alerts may be omitted when e.g. speaking with a PC’s serial interface. If the DTE actually requires these alerts both a second MAX232 is required, or another IC from the MAX232 household can be utilized (if it may be present in shopper digital retailers in any respect). Another for DTR/DSR can also be given beneath.

Maxim’s knowledge sheet explains the MAX232 household in nice element, together with the pin configuration and the best way to join such an IC to exterior circuitry. This info can be utilized as-is in personal design to get a working RS-232 interface. Maxim’s knowledge simply misses one vital piece of data: How precisely to attach the RS-232 alerts to the IC. So right here is one potential instance:

MAX232 to RS232 DE9 Connection as a DCE
MAX232 Pin Nbr. MAX232 Pin Identify Sign Voltage DE9 Pin
7 T2out RTS RS-232 8
8 R2in CTS RS-232 7
9 R2out CTS TTL n/a
10 T2in RTS TTL n/a
11 T1in TX TTL n/a
12 R1out RX TTL n/a
13 R1in TX RS-232 3
14 T1out RX RS-232 2
15 GND GND 0 5

As well as one can straight wire DTR (DE9 pin 4) to DSR (DE9 pin 6) with out going by any circuitry. This offers computerized (mind lifeless) DSR acknowledgment of an incoming DTR sign.

Generally pin 6 of the MAX232 is tough wired to DCD (DE9 pin 1). This isn’t really useful. Pin 6 is the uncooked output of the voltage pump and inverter for the -10 V voltage. Drawing currents from the pin results in a fast breakdown of the voltage, and as a consequence to a breakdown of the output voltage of the 2 RS-232 drivers. It’s higher to make use of software program which does not care about DCD, however does hardware-handshaking through CTS/RTS solely.

The circuitry is accomplished by connecting 5 capacitors to the IC because it follows. The MAX232 wants 1.0 µF capacitors, the MAX232A wants 0.1 µF capacitors. MAX232 clones present related variations. It is strongly recommended to seek the advice of the corresponding knowledge sheet. At the very least 16 V capacitor sorts must be used. If electrolytic or tantalic capacitors are used, the polarity must be noticed. The primary pin as listed within the following desk is all the time the place the plus pole of the capacitor must be related to.

MAX232(A) exterior Capacitors
Capacitor + Pin – Pin Comment
C1 1 3
C2 4 5
C3 2 16
C4 GND 6 This seems non-intuitive, however as a result of pin 6 is
on -10 V, GND will get the + connector, and never the –
C5 16 GND

The 5 V energy provide is related to

  • +5 V: Pin 16
  • GND: Pin 15

Options[edit]

Knowledge Cables[edit]

With the rise of cellphones so known as knowledge cables for these telephones have additionally turn into well-liked. These are cables to attach the cell phone to a serial interface of a pc[1]. The attention-grabbing factor is that trendy cellphones work with 3.3 V logic, and older telephones with 5 V logic on their knowledge buses. So these knowledge cables should and do convert the cellphone logic voltage ranges to and from RS232 voltage ranges.

No-name knowledge cables have turn into slightly low cost (as reverse to unique phone-brand knowledge cables). A budget cables with their voltage converters can be utilized as a substitute for home-made MAX232-based circuitry. The benefit is that the cables occupy a lot much less area (the converter is normally contained in the RS232 plug). Such a cable additionally saves the trouble to solder a circuitry board. One other benefit, which will also be an obstacle of such an information cable is that they normally take their energy from the RS232 connector. This protects an exterior energy provide, however may trigger issues, as a result of the RS232 interface is just not designed to energy some logic and the DTE may not present sufficient energy[2]. One other drawback is that many of those cables simply help RX and TX (one receiver, one driver), and never two drivers/receivers because the MAX232. So there isn’t any {hardware} handshake potential. Lastly, when utilizing such a cable it must be made certain that they convert to the specified voltage (3.3 V or 5 V).


  1. ^ There are additionally knowledge cables for USB ports, however these are of no curiosity right here.
  2. ^ Some knowledge cables are powered by the cellphone and never through the RS232 interface. In such a case an exterior energy provide remains to be wanted, to exchange the one from the cellphone.

[ RS-232 Converter”>edit]

USB to Serial interface cables usually have two parts: a USB transceiver that outputs serial knowledge; and a voltage shifter to provide standards-compliant RS-232 voltages. It’s usually potential to throw away (ignore, desolder, cut-out) the USB a part of these cables, join an exterior 5 V energy supply (or abuse the RS-232 interface) to exchange the ability coming from the USB bus and to only use the RS-232 level-shifter. All that is most likely as a lot work as utilizing a MAX232A, though you get one RS-232 connector totally free.

In the event you contemplate a USB cable, it’s also worthwhile to think about using USB straight, as an alternative of RS-232. Many USB transceiver chips may be built-in straight into circuits, eliminating the necessity for voltage-shifting parts. Components such because the FTDI FT232BM even have an enter permitting designers to pick out 5 V or 3.3 V output ranges. Most of those USB transceiver chips can be found as surface-mount parts solely. However some distributors provide DIP-sized preassembled modules, usually at aggressive costs, and sometimes with free or low cost drivers or driver growth environments.

See Serial Programming:Common Serial Bus for extra on USB {hardware}, interfacing with USB units and programming USB units.

MAX232N[edit]

A Texas Devices MAX232 (not A) second-source. The N signifies the bundle (plastic dip), and never any particular electrical traits. It is a non-A MAX232, due to this fact it wants at the least 1µF capacitors. It may typically be discovered slightly low cost. TI additionally gives MAX3232s and quite a lot of different RS-232 drivers/receivers, like MC148x.

Linear Expertise LT1181A[edit]

The LT1181A from Linear Expertise is similar to the MAX232A. It has the very same pin-layout, additionally makes use of 0.1µF capacitors, and might usually change a MAX232A. Nonetheless, for the hobbyist it’s usually somewhat bit harder to get one, they usually are usually barely dearer than the unique Maxim MAX232A.

Intersil HIN202[edit]

The Intersil HIN202 is one more IC similar to the MAX232A. It additionally has the identical pin-layout (DIL bundle), makes use of 0.1 µF capacitors and might change a MAX232A. The HIN202 is very attention-grabbing when extra I/O strains are wanted (4 pairs), because the producer specifies that two HIN202’s can share a single V+ and a single V- capacitor. So the ensuing circuit saves two capacitors.

MC1488 and MC1489[edit]

The MC1488/MC1489 ICs have already been talked about. Nonetheless, they’re no actual various to a MAX232 today. A combo of those ICs has twice as many drivers/receivers, however the MC1488 driver requires a +12 V, -12 V energy provide, and the MC1489 receiver a +5 V energy provide. That makes three energy provides as an alternative of 1 for the MAX232. Except the required ±12 V provide strains are already obtainable in a circuit, it is strongly recommended to make use of both two MAX232s, or a single MAX238.

Exterior hyperlinks[edit]


Leave a Reply

Your email address will not be published. Required fields are marked *