So, the maximum RS-232 signal levels are far too high for today's TTL logic electronic hardwares, and the negative
RS-232 voltage can't be grokked at all by the TTL logic. Therefore, to receive serial data from an RS-232 interface the voltage has to be reduced, and the 0 and 1voltage levels inverted. In the other direction (sending data from some logic over RS-232) the low logic voltage has to be "bumped up", and a negative voltage has to be generated, too.
All this can be done with conventional analog electronics, e.g. a particular power supply and a couple of transistors or the once popular 1488 (transmitter) and 1489 (receiver) ICs. However, since more than a decade it has become standard in amateur electronics to do the necessary signal level conversion with an integrated circuit (IC) from the MAX232 family (typically a MAX232A or some clone). In fact, it is hard to find some RS-232 circuitry in amateur electronics without a MAX232A or some clone.
It should be noted that the MAX232(A) is just a driver/receiver. It does not generate the necessary RS-232 sequence of marks and spaces with the right timing, it does not decode the RS-232 signal, it does not provide a serial/parallel conversion. All it does is to convert signal voltage levels. Generating serial data with the right timing and decoding serial data has to be done by additional circuitry, e.g. by a 16550 UART or one of these small micro controllers (e.g. Atmel AVR, Microchip PIC) getting more and more popular.
The original manufacturer (and now some clone manufacturers, too) offers a large series of similar ICs, with different numbers of receivers and drivers, voltages, built-in or external capacitors, etc. E.g. The MAX232 and MAX232A need external capacitors for the internal voltage pump, while the MAX233 has these capacitors built-in. The MAX233 is also between three and ten times more expensive in electronic shops than the MAX232A because of its internal capacitors. It is also more difficult to get the MAX233 than the garden variety MAX232A.
A similar IC, the MAX3232 is nowadays available for low-power 3V logic.
MAX232(A) DIP Package
Nbr | Name | Purpose | Signal Voltage | Capacitor Value MAX232 | Capacitor Value MAX232A |
1 | C1+ | + connector for capacitor C1 | capacitor should stand at least 16V | 1µF | 100nF |
2 | V+ | output of voltage pump | +10V, capacitor should stand at least 16V | 1µF to VCC | 100nF to VCC |
3 | C1- | - connector for capacitor C1 | capacitor should stand at least 16V | 1µF | 100nF |
4 | C2+ | + connector for capacitor C2 | capacitor should stand at least 16V | 1µF | 100nF |
5 | C2- | - connector for capacitor C2 | capacitor should stand at least 16V | 1µF | 100nF |
6 | V- | output of voltage pump / inverter | -10V, capacitor should stand at least 16V | 1µF to GND | 100nF to GND |
7 | T2out | Driver 2 output | RS-232 | ||
8 | R2in | Receiver 2 input | RS-232 | ||
9 | R2out | Receiver 2 output | TTL | ||
10 | T2in | Driver 2 input | TTL | ||
11 | T1in | Driver 1 input | TTL | ||
12 | R1out | Receiver 1 output | TTL | ||
13 | R1in | Receiver 1 input | RS-232 | ||
14 | T1out | Driver 1 output | RS-232 | ||
15 | GND | Ground | 0V | 1µF to VCC | 100nF to VCC |
16 | VCC | Power supply | +5V | see above | see above |
V+(2) is also connected to VCC via a capacitor (C3). V-(6) is connected to GND via a capacitor (C4). And GND(15) and VCC(16) are also connected by a capacitor (C5), as close as possible to the pins.
EQUIVALENT IC DIAGRAM:
A Typical Application
The MAX232(A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers (converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232 signals can be converted in each direction. The old MC1488/1498 combo provided four drivers and receivers.
Typically a pair of a driver/receiver of the MAX232 is used for
- TX and RX
and the second one for
- CTS and RTS.
There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and DCD signals. Usually these signals can be omitted when e.g. communicating with a PC's serial interface. If the DTE really requires these signals either a second MAX232 is needed, or some other IC from the MAX232 family can be used (if it can be found in consumer electronic shops at all). An alternative for DTR/DSR is also given below.
Maxim's data sheet explains the MAX232 family in great detail, including the pin configuration and how to connect such an IC to external circuitry. This information can be used as-is in own design to get a working RS-232 interface. Maxim's data just misses one critical piece of information: How exactly to connect the RS-232 signals to the IC. So here is one possible example:
MAX232 Pin Nbr. | MAX232 Pin Name | Signal | Voltage | DB9 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 |
In addition one can directly wire DTR (DB9 pin 4) to DSR (DB9 pin 6) without going through any circuitry. This gives automatic (brain dead) DSR acknowledgment of an incoming DTR signal.
Sometimes pin 6 of the MAX232 is hard wired to DCD (DB9 pin 1). This is not recommended. Pin 6 is the raw output of the voltage pump and inverter for the -10V voltage. Drawing currents from the pin leads to a rapid breakdown of the voltage, and as a consequence to a breakdown of the output voltage of the two RS-232 drivers. It is better to use software which doesn't care about DCD, but does hardware-handshaking via CTS/RTS only.
The circuitry is completed by connecting five capacitors to the IC as it follows. The MAX232 needs 1.0µF capacitors, the MAX232A needs 0.1µF capacitors. MAX232 clones show similar differences. It is recommended to consult the corresponding data sheet. At least 16V capacitor types should be used. If electrolytic or tantalic capacitors are used, the polarity has to be observed. The first pin as listed in the following table is always where the plus pole of the capacitor should be connected to.
Capacitor | + Pin | - Pin | Remark |
C1 | 1 | 3 | |
C2 | 4 | 5 | |
C3 | 2 | 16 | |
C4 | GND | 6 | This looks non-intuitive, but because pin 6 is on -10V, GND gets the + connector, and not the - |
C5 | 16 | GND |
The 5V power supply is connected to
- +5V: Pin 16
- GND: Pin 15
Tidak ada komentar:
Posting Komentar