Advertisement
Advertisement

Single µC pin makes half-duplex RS-232C

-August 05, 1999

In many µC designs, nearly all the I/O pins are occupied. If only one I/O pin is available, the circuit in Figure 1 can help you implement a serial RS-232C interface. For many purposes, half-duplex operation using a software-driven RS-232C interface provides a good communications link. Many µCs have open-drain I/O pins, as shown on the left of the figure. In the idle state, the RS-232C lines Rx and Tx both assume a negative voltage; their TTL counterparts assume a high level. The I/O pin is also at a high level, and neither D1 nor Q1 conduct. If a mark signal on the Rx line pulls the Rx line high, D1 conducts, the I/O pin goes low, and the µC reads this low level. Because the base of Q1 is negative with respect to its emitter, Q1 does not conduct and Tx does not retransmit the mark level. If the µC wants to transmit a mark, it pulls the I/O pin low (by setting power to low).

Now the emitter of Q1 is at ground level, and the high level on the Rx interface output supplies base current to Q1 via R3. Q1 conducts, and the RS-232C Tx driver input goes low. The MAX232 driver transmits a high-level mark signal. In this way, Q1 and D1 simply provide a route from Rx to the I/O pin when the circuit receives characters without echoing them, and the µC itself also transmits characters. R1 is necessary only if no internal pullup resistor is available. You can use this type of circuit for service purposes in many designs, such as to connect a PC to a pin of a µC. At startup, the µC sends a short message to the PC. Then, the PC sends initialization or debugging parameters to the µC. During normal operation, the µC reports its actions to the PC by transmitting the appropriate data. If the circuit has a pin with edge-triggered interrupt capability, you can even implement interrupt-driven I/O. (DI #2397).


Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES