Shop OBEX P1 Docs P2 Docs Learn Events
Rs485 — Parallax Forums

Rs485

TomSTomS Posts: 128
edited 2007-04-28 20:27 in Propeller 1
I want to implement a 2-wire RS485 interface using the propeller and a RS485 chipset. As far as I can tell I will only need to disable the xmtr after the last character is sent and I should be able to use something like the Simple-Serial spin object. Have any of you experience in implementing an RS485 interface?

Thanks

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2007-04-28 13:11
    Basically that's all you have to do to turn the line back around to receive again although you should allow for at least 1.5 stop bits. However RS485 implies that there are multiple devices sharing the bus, usually as single master and multiple slaves. This means you need an addressing scheme so that only the one you are talking to responds. How is the address detected? In MODBUS there is an interpacket gap of at least 3.5 characters to signal that a packet has been completed and that any new character coming in is the start of a new packet (where the first character is in fact the target address). Other protocols may use a 9th data bit to signal the character as an address but there are many variations.

    If you simply need to communicate point-to-point over a long distance then consider the simpler full-duplex RS422.

    *Peter*
  • Tracy AllenTracy Allen Posts: 6,660
    edited 2007-04-28 17:25
    Hi Tom,

    In many ways, RS485 is simpler than other protocols, in that it does not require the +/- power supplies, and it uses only two wires for long distances on a multidrop network. It requires one chip, not a chipset. I favor the LT1785, 8 pin dip or soic. The interface to your Prop is only two pins, because the data in and out lines and also the transmitter and receiver enable lines can be tied together. Tie your A and B lines to the RS485 network, and provide 5 volts power to the chip. The systems I work with usually take a command from the master for one of the slaves to do something, then a configurable line turnaround time, followed by the response from the slave.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TomSTomS Posts: 128
    edited 2007-04-28 19:04
    My implementation uses the LT1785 and is the master. I've used RS485 with commercial instruments but haven't done anything on my own until now. The protocol is fixed (the same as the commercial instument I'm replacing & It's open source). I don't understand how you can get by with only two pins. You have an xmit & rcx pin and don't you have to disable the xmtr when rcxing? B & B Electronics recommends disabling the xmtr one character space after the last character is transmitted. I guess you could use a re-triggerable one-shot to disable the xmtr. Is that what you do to get by with only two pins? What about disabling the rcxr? Or do you simply ignore the echoed transmitted data? Thanks for your replies.

    Tom
  • Tracy AllenTracy Allen Posts: 6,660
    edited 2007-04-28 19:56
    On the LT1785, the RE\ pin is active low, and when high the receiver output RO is high impedance. The DE pin is active high, and when low the driver to the RS485 line A/B is high impedance. If RE\ and DE are tied together to one pin, then high enables drive out to the RS485, and low enables input from RS485. The data lines DI and RO are also tied together to one pin that is alternately input and output. I have a little RS485 rider board that I use for projects, so it includes those connections and also a power supply that can be switched on and off to power the connected RS485 instruments via a seccond pair of wires.

    Another reason you might want to keep RE\ and DE separate would be to take advantage of the powerdown mode,. Also, CAN bus operation would use DE as a data input.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TomSTomS Posts: 128
    edited 2007-04-28 20:27
    Thanks Tracy,

    All is clear now.

    Tom
Sign In or Register to comment.