Step 21 : RS485 Input Circuitry

In my opinion this is one of the hardest circuits to understand in the entire controller. I hope to alleviate some of this confusion.
R1 = 120
R2, R3 = 1K
R4, R5 = 27K
D1 = 1N5229
D2 = 1N5239
U1 = The chip is any RS485 chip.
The front-end circuit was inspired by the TI document SLLA036B, entitled "Interface Circuits for TIA/EIA-485 (RS-485)".
http://focus.ti.com/lit/an/slla036b/slla036b.pdf
In order to make the board input universal, discrete components are being used to allow the RS485 receiver to directly receive RS232. RS232 uses alternating plus and minus voltages to signal mark and space. So depending on the computer serial port you could have anything from +/-3 volts to +/-15 volts on the wire. The RS485 uses differential "0" and 5 volts to signal mark and space. so directly connecting the RS232 transmitter to an RS485 receiver is deadly to the receiver. It will choke or croak on the -5 - 15 volts.
The main purpose of the resistors (two 1K and two 27K) is to ensure that the output of the RS495 chip goes to a known and reliable state when the input cable is either open or shorted. The A pin is pulled-up, and the B pin is pulled down. While the two 1K resistors limit current in the event of a direct short.
The purpose of the Zener diodes is to prevent the input of the 75176 from going outside of the allowed range when the circuit is driven with an RS232 signal.
The 120 Ohm resistor is for matching impedance as 120 Ohms is the typical impedance of twisted pair. The 120 Ohm resistor is placed between pins 4 and 5 of the input RJ45 connector.
If you are using RS485 for PC to controller then the only thing you need is the 120 ohm resister between the A/B leads on the 485. If you are using RS232 then the best choice is to put an RS232 chip at the input. MAX232 or any of the many others. But in “Phil’s design” (The universal design) he does a couple of things to make both possible. The 27K resistor to connecting the "A" to VCC and the "B" to ground are what they consider "weak Pull-ups". They are there to ensure the input is in a known state if the computer is disconnected. That is their only function.
The 1K resistors are there to limit the current drawn from an RS232 transmitter if it is connected. (They also limit current if an RS485 transmitter is connected but don't hurt the situation).
If an RS232 transmitter is used the "TXD" lead is connected to the RS485 "B" lead. The "A" lead is pulled to VCC(+5V). The output of the receiver switches when the "B" input goes above and below 5 volts.
The Zener diodes from the "B" lead to ground are there to limit how far negative the "B" lead is pulled when an RS232 transmitter is connected.
The data sheet on the 485 lists "Receiver Input Voltage ... -8V to +12.5V" These are the "Absolute Maximum" values. In reality don't go there.
A Zener diode voltage drop is around .7V forward and 5V reverse (assuming a 5V Zener). so putting the diodes back to back is a way to limit the voltage in both polarities.
The 1N5239 is a 9.1V Zener and the 1N5229 is a 4.3V Zener so the net effect is to limit the "B" pin to a maximum of +9.1volts and -4.3volts. 1N5229 (4.3 V Zener, limits 485 input to -5.0 V), 1N5239 (9.1V Zener, limits 495 input to +9.8V)
The 1K resister in series between connector and the "B" pin limits the Zener current just like in any Zener regulator circuit.
In summary:
Don’t mix up pins 4 and 5 on the RS485. Look at the picture above closely, and play by the rules.