Serial Port Complete - Latest Microcontroller projects

(lily) #1
Inside RS-485

Figure 6-9 shows a half-duplex network that uses an SN75176B differential bus
transceiver.
When a driver’s enable input (DE) is low, the driver’s output is high impedance,
and for all practical purposes the driver is removed from the circuit. When a
receiver’s enable input (/RE) is high, the receiver’s output is high impedance
and no longer follows the RS-485 input. Chapter 7 has more about biasing this
type of network to ensure valid signal levels when the network lines are idle,
open, or shorted.

 8  
!"


Some applications require converting RS-232 signals to RS-485. If a computer
has an available RS-232 port, adding an external converter can be cheaper and
easier than buying and installing an RS-485 card or USB converter. Converter
modules are available from a variety of sources, or you can make your own. If
you need high speed, be aware that RS-232 drivers can limit the top speed of
the RS-485 interface.
Microcontroller development boards sometimes have RS-232 interfaces
built-in. If you need RS-485, it might be easier to bypass the RS-232 interface
by removing the RS-232 interface chip or the connections to it and wiring the
RS-485 interface directly to the microcontroller’s port pins.

0    
Figure 6-10 shows one way to convert RS-232 to RS-485. The interface uses
three RS-232 lines: TX transmits data, RX receives data, and RTS controls
direction. A MAX233 converts the RS-232 signals to TTL levels, and the TTL
signals connect to an SN75176B or similar chip that provides the RS-485 inter-
face.
When RTS is low, the enable inputs of the SN75176B are high and TX can
transmit on the RS-485 line. When RTS is high, the enable inputs are low and
RX can receive data on the RS-485 line. A circuit can use DTR instead of RTS.
It’s likely that the cable from the RS-232 port to the converter will be no more
than a few feet long. In this case, you can use Chapter 4’s short-range transistor
circuit in place of the MAX233 or other converter chip.
In a similar way, you can create full-duplex RS-232-to-RS-485 interfaces using
a SN75179B or other 4-wire RS-485 chip.
Free download pdf