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

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

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

Applicability[edit]

This module is main of curiosity for folks constructing their very own electronics with an RS-232 interface.
Off-the-shelf computer systems with RS-232 interfaces already comprise the required 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 suitable with right now’s pc logic voltages. However, basic 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 right now’s pc logic electronics, and the unfavorable RS-232 voltage cannot be generated in any respect by the pc logic. Subsequently, to obtain serial knowledge from an RS-232 interface the voltage needs to be decreased, and the 0 and 1 voltage ranges inverted. Within the different path (sending knowledge from some logic over RS-232) the low logic voltage needs to be “bumped up”, and a unfavorable voltage needs to 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 completed with standard analog electronics, e.g. a selected energy provide and a few transistors or the as soon as fashionable MC1488 (transmitter) and MC1489 (receiver) ICs. Nevertheless, since greater than a decade it has change into commonplace in beginner electronics to do the required sign stage conversion with an built-in circuit (IC) from the MAX232 household (sometimes a MAX232A or some clone). The truth is, it’s exhausting to seek out some RS-232 circuitry in beginner 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 package deal accommodates the required drivers (two) and receivers (additionally two), to adapt the RS-232 sign voltage ranges to TTL logic. It grew to become fashionable, as a result of it simply wants one voltage (+5 V) and generates the required RS-232 voltage ranges (approx. -10 V and +10 V) internally. This vastly 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 virtually similar, nonetheless, the MAX232A is way more typically 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 required RS-232 sequence of marks and areas with the suitable 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 suitable timing and decoding serial knowledge needs to be completed by extra circuitry, e.g. by a 16550 UART or one in all these small micro controllers (e.g.
Atmel AVR,
Microchip PIC) getting increasingly more fashionable.

The MAX232 and MAX232A have been as soon as reasonably costly ICs, however right now they’re low-cost. It has additionally helped that many firms now produce clones (ie. Sipex). These clones typically want completely different exterior circuitry, e.g. the capacities of the exterior capacitors fluctuate. It is suggested to test the information sheet of the actual producer of an IC as a substitute of counting on Maxim’s unique knowledge sheet.

The unique producer (and now some clone producers, too) provides a big collection of comparable ICs, with completely different numbers of receivers and drivers, voltages, built-in or exterior capacitors, and so forth. 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 instances costlier in digital outlets than the MAX232A due to its inner capacitors. It’s also harder to get the MAX233 than the backyard selection MAX232A.

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

MAX232(A) DIP Bundle

MAX232 Pinout.svg

MAX232(A) DIP Bundle Pin Format
Nbr Identify Function Sign Voltage Capacitor Worth MAX232 Capacitor Worth MAX232A
1 C1+ + connector for capacitor C1 capacitor ought to stand at the very least 16 V 1 µF 100 nF
2 V+ output of voltage pump +10 V, capacitor ought to stand at the very least 16 V 1 µF to VCC 100 nF to VCC
3 C1- – connector for capacitor C1 capacitor ought to stand at the very least 16 V 1 µF 100 nF
4 C2+ + connector for capacitor C2 capacitor ought to stand at the very least 16 V 1 µF 100 nF
5 C2- – connector for capacitor C2 capacitor ought to stand at the very least 16 V 1 µF 100 nF
6 V- output of voltage pump / inverter -10 V, capacitor ought to stand at the very 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 doable 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 might be transformed in every path. The outdated MC1488/1489 combo supplied 4 drivers and receivers.

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

and the second for

There are usually not sufficient drivers/receivers within the MAX232 to additionally join the DTR, DSR, and DCD alerts. Normally these alerts might 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 outlets in any respect). An alternate 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 find out how 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 crucial piece of knowledge: How precisely to attach the RS-232 alerts to the IC. So right here is one doable 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 instantly wire DTR (DE9 pin 4) to DSR (DE9 pin 6) with out going via any circuitry. This offers computerized (mind lifeless) DSR acknowledgment of an incoming DTR sign.

Typically pin 6 of the MAX232 is difficult 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 speedy 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 suggested to seek the advice of the corresponding knowledge sheet. At the least 16 V capacitor varieties must be used. If electrolytic or tantalic capacitors are used, the polarity needs to be noticed. The primary pin as listed within the following desk is at all times 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

Alternate options[edit]

Information Cables[edit]

With the rise of cellphones so known as knowledge cables for these telephones have additionally change into fashionable. These are cables to attach the cell phone to a serial interface of a pc[1]. The fascinating 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 change into reasonably low-cost (as reverse to unique phone-brand knowledge cables). A budget cables with their voltage converters can be utilized as an alternative choice to home-made MAX232-based circuitry. The benefit is that the cables occupy a lot much less house (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 a drawback of such a knowledge cable is that they normally take their energy from the RS232 connector. This protects an exterior energy provide, however can even trigger issues, as a result of the RS232 interface shouldn’t be designed to energy some logic and the DTE may not present sufficient energy[2]. One other drawback is that many of those cables simply assist RX and TX (one receiver, one driver), and never two drivers/receivers because the MAX232. So there isn’t any {hardware} handshake doable. 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 interchange the one from the cellphone.

[ RS-232 Converter”>edit]

USB to Serial interface cables typically have two elements: a USB transceiver that outputs serial knowledge; and a voltage shifter to supply standards-compliant RS-232 voltages. It’s typically doable 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 interchange the ability coming from the USB bus and to simply use the RS-232 level-shifter. All that is in all probability as a lot work as utilizing a MAX232A, though you get one RS-232 connector free of charge.

In case you think about a USB cable, it’s also worthwhile to think about using USB instantly, as a substitute of RS-232. Many USB transceiver chips might be built-in instantly into circuits, eliminating the necessity for voltage-shifting elements. Components such because the FTDI FT232BM even have an enter permitting designers to pick 5 V or 3.3 V output ranges. Most of those USB transceiver chips can be found as surface-mount elements solely. However some distributors supply DIP-sized preassembled modules, typically at aggressive costs, and infrequently with free or low-cost drivers or driver improvement 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 package deal (plastic dip), and never any particular electrical traits. This can be a non-A MAX232, subsequently it wants at the very least 1µF capacitors. It might typically be discovered reasonably low-cost. TI additionally provides MAX3232s and quite a lot of different RS-232 drivers/receivers, like MC148x.

Linear Know-how LT1181A[edit]

The LT1181A from Linear Know-how is similar to the MAX232A. It has the very same pin-layout, additionally makes use of 0.1µF capacitors, and might normally change a MAX232A. Nevertheless, for the hobbyist it’s sometimes a little bit bit harder to get one, and so they are usually barely costlier 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 package deal), makes use of 0.1 µF capacitors and might change a MAX232A. The HIN202 is particularly fascinating when extra I/O strains are wanted (4 pairs), for the reason that 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. Nevertheless, 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 a substitute of 1 for the MAX232. Until the required ±12 V provide strains are already accessible in a circuit, it is suggested 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 *