What is UART?
UART stands for Universal Asynchronous Receiver/Transmitter. As its name implies, it is universal. It can be used to establish a communication between a microcontroller and another device – microcontroller, USB controller, Bluetooth modules, GSM modules, GPS modules, personal computers, etc.
I am not going to discuss the UART protocol here. If UART is still unknown to you, you may read this article from wikipedia first.
What is RS-232?
RS-232 is a standard for serial transmission of data between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly found in desktop computers where it is commonly referred as COM port. You can read this wikipedia article for more info about the RS-232 standard.
AT89C2051 UART
The AT89C2051 has one UART port. Its TXD (Transmit) pin is the same as its P3.1 pin. Its RXD (Receive) pin is the same as its P3.0 pin.
AT89C2051 RS-232 Interface
The UART port of a microcontroller can be used to interface to a RS-232 port of a personal computer. However, the voltage levels of UART must be converted to voltage levels compatible to RS-232.
To convert UART voltage levels to RS-232 voltage levels, you may use the following circuits:
1. Using a MAX232 or similar IC

This is the most preferred circuit to convert UART using the TTL voltage levels to RS232 voltage levels. The 5V levels are converted by MAX232 to -9V to -12V and vice versa. The 0V levels are converted by MAX232 to +9V to +12V and vice versa.
The female DB-9 connector is used to connect with the RS-232 port of a personal computer.
2. Using Transistors

