What is the function of diode and capacitor in RS232 shifter circuit?
RS232 logic levels are (from memory)


high: -12 to -3 V.
low: +3 to +12 V.


Since your level shifter is interfacing with a device with only a single-ended, positive supply there is a problem sending out a high signal on RX-RS232.

The trick here is to steal some power from the TX signal of the other device when it is high (negative). The diode charges the capacitor to a negative voltage and this is used to bias the RX line negative if the TX-TTL signal is high (which will turn the PNP transistor off).



When the TX-TTL signal is high and the PNP turned off there is a potential divider formed between the three 10k resistors, 1, 2 &amp; 3. The best that can be obtained from this arrangement is that the RX line will be a little more positive (due to the diode drop) than \$ \frac {2}{3}V_{TX} \$. If VTX is weak (close to -3 V) this circuit may not work as the voltage to the other device's RX will be out of specification.