Shop OBEX P1 Docs P2 Docs Learn Events
Making 2 BS2 Modules work together — Parallax Forums

Making 2 BS2 Modules work together

I am wondering if their is a way to make 2 basic stamp 2 modules communicate? If so what lines of code do we use and how do we wire them together? Thanks for any help you can offer smile.gif

-Andy burger.gif

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-12-01 11:40
    Have a look in the online helpfile under SERIN or SEROUT. Connections and sample code are right there.

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

    http://www.siskconsult.com
    ·
  • UghaUgha Posts: 543
    edited 2008-12-01 13:47
    You can absolutely get two stamps to work together.

    Both the code and the wiring are very simple as long as you only stick to two...

    Just connect a decent resistor (220 - 470ohm is what I use) bridging a pin from one stamp to the other.
    If you want two way communication then do the same for another pin.

    You'll need to establish a baud rate for the communication. I usually use 2400T... which on the normal BS2 is code 396.

    The code would be simple... for pin 0 it'd be something like this:

    SEROUT 0, 396, [noparse][[/noparse]"Hello world!"]

    Then you'd need a SERIN on the second stamp to receive the byte array.

    WARNING! Never drive one stamp high while the other low.
    In fact, just avoid HIGH and LOW commands all together and use serial communication... and never try to use the
    same line to send information both ways. You'll end up with one stamp getting out of sync with the other and you'll
    still have a HIGH->LOW situation and two burnt stamps.

    Don't forget SERIN pauses for input, so its best to have one stamp be a master, and one a slave.
  • rdinghamrdingham Posts: 5
    edited 2009-01-14 07:17
    What is the purpose of the 470 ohm resistor between the stamps?

    I'm trying to use two serial ports with the stamp as a go-between, and I keep loosing data.
  • SRLMSRLM Posts: 5,045
    edited 2009-01-14 07:42
    The resistor protects the input of the I/O pin.
  • remmi870remmi870 Posts: 79
    edited 2009-01-14 07:50
    i think you cant use a stamp as a go between for data, besides the fact that the baud rate would have to be too slow and if it is bringing data in and sending it out, while your sending the data out it cant recive at the same time, there is no buffer.
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-01-14 11:40
    Connecting 2 stamps - any variety

    All the work is done for you, both hardware and software,
    if you look here.

    http://forums.parallax.com/showthread.php?p=765140

    humanoido
Sign In or Register to comment.