8051 CONNECTION TO RS232

SECTION 10.2: 8051 CONNECTION TO RS232
In this section, the details of the physical connections of the 8051 to RS232 connectors are given. As stated in Section 10.2, the RS232 standard is not TTL compatible; therefore, it requires a line driver such as the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa. The interfacing of 8051 with RS232 connectors via the MAX232 chip is the main topic of this section.
RxD and TxD pins in the 8051
The 8051 has two pins that are used specifically for transferring and receiving data serially. These two pins are called TxD and RxD and are part of the port 3 group (P3.0 and P3.1). Pin 11 of the 8051 (P3.1) is assigned to TxD and pin 10 (P3.0) is designated as RxD. These pins are TTL compatible; therefore, they require a line driver to make them RS232 compatible. One such line driver is the MAX232 chip. This is discussed next.
MAX232
Since the RS232 is not compatible with today’s microprocessors and microcontrollers, we need a line driver (voltage converter) to convert the RS232′s signals to TTL voltage levels that will be acceptable to the 8051 ‘s TxD and RxD pins. One example of such a converter is MAX232 from Maxim Corp. (www.maxim-ic.com). The MAX232 converts from RS232 voltage levels to TTL voltage levels, and vice versa. One advantage of the MAX232 chip is that it uses a +5 V power source which, is the same as the source voltage for the 8051. In other words, with a single +5 V power supply we can power both the 8051 and MAX232, with no need for the dual power supplies that are common in many older systems.
The MAX232 has two sets of line drivers for transferring and receiving data, as shown in Figure 10-7. The line
drivers used for TxD are called Tl and T2,





Figure 10-7. (a) Inside MAX232 and (b) its Connection to the 8051 (Null Modem)





while the line drivers for RxD are designated as Rl and R2. In many applications only one of each is used. For example, Tl and Rl are used together for TxD and RxD of the 8051, and the second set is left unused. Notice in MAX232 that the Tl line driver has a designation of Tlin and Tlout on pin numbers 11 and 14, respectively. The Tlin pin is the TTL side and is connected to TxD of the microcontroller, while Tlout is the RS232 side that is connected to the RxD pin of the RS232 DB connector. The Rl line driver has a designation of Rlin and Rlout on pin numbers 13 and 12, respectively. The Rlin (pin 13) is the RS232 side that is connected to the TxD pin of the RS232 DB connector, and Rlout (pin 12) is the TTL side that is connected to the RxD pin of the microcontroller. See Figure 10-7. Notice the null modem connection where RxD for one is TxD for the other.

MAX232 requires four capacitors ranging from 1 to 22 nF. The most widely used value for these capacitors is 22 nF.
MAX233


Figure 10-8. (a) Inside MAX233 and (b) Its Connection to the 8051 (Null Modem)
To save board space, some designers use the MAX233 chip from Maxim. The MAX233 performs the same job as the MAX232 but eliminates the need for capacitors. However, the MAX233 chip is much more expensive than the MAX232. Notice that MAX233 and MAX232 are not pin compatible. You cannot take a MAX232 out of a board and replace it with a MAX233. See Figure 10-8 for MAX233 with no capacitor used.

Next post:

Previous post: