Shop OBEX P1 Docs P2 Docs Learn Events
BS2 communicating using ModBus — Parallax Forums

BS2 communicating using ModBus

anthr4xanthr4x Posts: 3
edited 2010-05-12 14:20 in BASIC Stamp
I have a BS2 with a few sensors connected and I'm wanting to connect it to a ModBus RTU network. Has any one done this or have information? I could fake it but I'm not sure how to go about calculating the CRC.

Thanks for any information you guys might have.

Comments

  • sumdawgysumdawgy Posts: 167
    edited 2010-05-12 14:09
    this site simlifies·the protocol breakdown

    http://www.rtaautomation.com/modbusrtu/

    This site lists the signal codes (with more info)
    http://en.wikipedia.org/wiki/Modbus


    Lasty, Here's info on..the serial modbus comms protocol.(obsolete)
    http://www.modbus.org/docs/PI_MBUS_300.pdf

    Drop·down to page 25.
    "The CRC is started by first preloading a 16–bit register to all 1’s. Then a process begins of applying......."

    There are more Docs listed there if this one won't apply.
    Have fun!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Before you criticize someone, walk a mile in his shoes. That way if he gets angry, he'll be a mile away and barefoot. - unknown
  • stamptrolstamptrol Posts: 1,731
    edited 2010-05-12 14:20
    The usual obstacle with RTU and a micro is calculating the CRC while maintaining the tight timing requirements.

    One technique in doing a repetitive query (like to several sensors) is to manually assemble the the query string, including the CRC and store that in the the Stamp as a DATA statement. Then, when you need to query the sensor just do the SEROUT of the stored Data and wait for the sensor response.

    There are several MODBUS test sites on the web which will allow you to enter the required sequence and it will calculate the required CRC for you.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
Sign In or Register to comment.