Shop OBEX P1 Docs P2 Docs Learn Events
Propeller FLIP microcontroller, RS485 interface — Parallax Forums

Propeller FLIP microcontroller, RS485 interface

Hi!
I need to establish communication between a PLC (S7-1200) and multiple Propeller FLIP microcontrollers.
To achieve that, I'm planning on using an RS485 communication module and having all microcontrollers sharing the same RS485 bus.
Is this possible? PLC would be the master and all microcontrollers, slaves.
How can I set different addresses for all microcontrollers? And do I need an RS485 driver IC?
Thank you in advance!

Comments

  • Not sure about what is possible from the PLC end but here's what I do between ucontrollers:

    There are many 422 transceivers, I happen to use the LTC491.

    My arrangement is like a Hybrid 422/485 because I use full duplex (4 wires).

    The Master always has the TX line dedicated and the RX is a shared response line so the Master has the attention of all slaves, all of the time.

    For static addressing, the addresses can be hard-coded or hard-wired-to inputs on each slave.

    In my case, I have a dynamic addressing system:

    1) On power-up, all addresses are zeroed and there is an assigned address input and address output on each uC
    2) Each slave sets its address output to the high state to start with
    3) The first slave has its address input tied permanently low.
    4) Address #1 is broadcast to all slaves
    5) Each slave, if not yet assigned an address, will take the broadcast value as its address if its address input is low. Then it sets its address output low which is tied to the address input of the next slave.
    6) Address #2 is broadcast to all slaves but is ignored by the first slave because it already has an address

    So apart from gnd, I have a 5-wire system.

  • I agree with the fellow wearing the brown derby. However I typically specify Maxim part numbers, including the MAX491 for RS485 work.

    TI also makes some excellent part numbers, as do several other firms. The unique nature of these parts is that you can mix and match them.

    ----
    Still no mascot.
  • I agree with the fellow wearing the brown derby. However I typically specify Maxim part numbers, including the MAX491 for RS485 work.

    TI also makes some excellent part numbers, as do several other firms. The unique nature of these parts is that you can mix and match them.

    ----
    Still no mascot.

    Good call! I usually expect anything Maxim to have a ridiculous price but not in this case

    :cool:
  • Thank you very much for your reply!
    When powered-off, does each microcontroller remember the previously assigned address?
    Can I set each address using dip switches? (was that what you meant by "hard-wired-to inputs"?)
    Could you please explain why do I need MAX491?
    Thank you in advance!
  • Thank you very much for your reply!
    When powered-off, does each microcontroller remember the previously assigned address?
    Can I set each address using dip switches? (was that what you meant by "hard-wired-to inputs"?)
    Could you please explain why do I need MAX491?
    Thank you in advance!

    I could store the address, locally but I choose not to. Initializing happens so fast that it's not an issue. My slaves are all identical and I like that I can simply swap a failed unit without any fuss.

    DIP switches, jumpers, wire-links, yeah.

    I use the 491 because I choose to go full duplex which requires 2 differential pairs (4 wires)... 1 pair for transmit and 1 pair for receive. The 485/422 specification is all about differential drivers/receivers to maximise noise immunity.

    The MAX491 datasheet is a good place to start.
  • On S7 you can use eg a CB/CM 1241 like 6ES7241-1CH32-0XB0 which have a DB9 connector.

    RS485(422) is an electrical standard and to meet its specifications on microcontroller side you will need a line driver IC, like others have suggested.
    I usually use MAX3160/1/2E because many times I reuse my developed hardware in many different applications. In this case I'll choose MAX3160E.
    The driver, beside voltage level translation, integrates also ESD protection.
    Because of hardware reuse, but also from debugging point of view, I like the dual-function RS485(422)-RS232.

    Regarding communication, as RS485 is only the physical-electrical standard, the protocol is up to you. You can use the Siemens FB/FC blocks (or even the SFC if you want to deal directly with the communication module) but you will need to build up from ground the propeller side. Or you can try to use a serial object from the OBEX and control the RS485 direction bit by yourself.

    For the link you can use also profibus (which is carried also over RS485 standard) connectors and thus use their bus termination if you use siemens DB9 connector layout.
    The address of your devices has to be setup into the device itself. It can be written to the device's eprom or set through a series of dip-switches on microcontroller's inputs. And of course it is part of your communication protocol and how you implement it. On the RS485 bus every node receives the message and it is its firmware that determines if it is addressed to it or not (many times based on some kind of physical address scheme)

    To today I haven't used serial connection on S7-1200 but I have many drivers written for the S7-300 and S7-400 (with ET200 on profibus) and the CP340/341 communication cards (that are similar to the 1241 one) for our hardware we have built (mainly very large displays, but also others).
Sign In or Register to comment.