Shop OBEX P1 Docs P2 Docs Learn Events
Sending data from Stamp to Stamp — Parallax Forums

Sending data from Stamp to Stamp

IRobot2IRobot2 Posts: 164
edited 2006-09-13 06:44 in BASIC Stamp
Does any one know of a way that you can make a Stamp send data to another Stamp?
·
For instance, if I would have a BS2 connected to a handful of sonar sensors and the only job of this BS2 was to poll those sensors to see if they have found an object in front of them. BUT once an object is found by one or more of these sensors it sends a “packet” of information to another Stamp that would control motors or other devices based on what the other Stamp had seen.
·
Basically since one Stamp would not be able to monitor many sensors and run to much hardware at the same time, I just wondered if you could bridge the gap.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Alex Burke


"The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment." ~Warren G. Bennis

Comments

  • JonathanJonathan Posts: 1,023
    edited 2006-03-28 16:46
    Alex,

    You sure can. The easiest way is serial communication. Check out the SEROUT and SERIN commands. There is an example of Stamp to Stamp serial comms in the Stamp docs.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • IRobot2IRobot2 Posts: 164
    edited 2006-03-28 17:01
    Is it just that simple? I feel kind of stupid for asking that question now. I guess some things should bounce around the brain a little longer before posting.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alex Burke


    "The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment." ~Warren G. Bennis
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-03-28 17:08
    Here is one URL with info on stamp to stamp communication using the Stamp's built in flow control in SERIN/SEROUT:

    www.emesystems.com/BS2rs232.htm#MasterSlave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • IRobot2IRobot2 Posts: 164
    edited 2006-03-28 17:49
    Thanks for the link Tracy. That really speeds things up for my project. I guess after looking at that though, I figured that there is no way to have two slaves and one master. Is that correct?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Alex Burke


    "The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment." ~Warren G. Bennis
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-03-28 18:09
    Alex -

    That is NOT correct. Check for the topic "Open Baud modes" in the PBASIC Stamp Manual for more information on multiple masters and slaves.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • SteelSteel Posts: 313
    edited 2006-03-28 18:35
    You can communicate with multiple slaves.· You define that in your communication protocol.

    In your Serout data, include a "Device Address" byte...this way you can control which device·this is sent to.

    On the·SERIN end, give each "Device" an address.· Include a WAIT command to wait for any communication to that address.

    Pseudo-Code for Master:
    ·· Device1 var byte
    ·· Device2 var byte
    ·· Device3 var byte

    ·· Device1 = FF
    ·· Device2 = FE
    ·· Device3 = FD

    ·· SEROUT (Device1, DataToDevice1)
    ·· SEROUT (Device2, DataToDevice2)
    ·· SEROUT (Device3, DataToDevice3)

    Pseudo-Code for Device1:
    ·· SERIN (Wait(FF),IncomingData)
    Pseudo-Code for Device2:
    ·· SERIN (Wait(FE),IncomingData)
    Pseudo-Code for Device3:
    ·· SERIN (Wait(FD),IncomingData)

    ...This way each device only recieves information that you send to it.

    Generally, when I send information i use a protocol.· It consists of the following:

    Header
    ·· Byte1 = Where Data should go
    ·· Byte2 = Data type (command, data, request information)
    ·· Byte3 = Total number of Packets
    ·· Byte4 = Packet Number
    Body
    ·· Byte5 - Byte8= Data being sent

    When my addressed device recieves the packet, it can say "This packet is for me...and it is sending me data...and there will be·X amount·more packets after this one that I need to look for"


    Post Edited (Steel) : 3/28/2006 6:41:07 PM GMT
  • larrywlarryw Posts: 4
    edited 2006-09-12 17:31
    Hello Steel, Alex,

    I'm doing similar: I use 1 BSP40 with 10 BS2 slaves, each has serin, serout and fc going to master.

    I would like to program each slave without having to move the computer DB9/USB from the master to each slave individually. If this is possible could you give me a quick sample of how to send a program through the editor to the master and on to the chosen slave memory so it will run when the power is turned on.

    Thanks,

    Larryw
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-13 00:21
    Well, it's POSSIBLE, but not trivial.

    The 'programming' algorithm involves hitting the 'DTR' (also known as "ATN") signal of the BS2 to 'reset' the BS2 to be programmed. Then there's a few bytes of 'handshake'. Then you download the program bytes to the '16' port. I think somebody has documented this, and used it to create a 'stache' which can be used in the field to download a program without a PC.
  • larrywlarryw Posts: 4
    edited 2006-09-13 06:44
    Found it. Clone program is found at emesystems.com

    Thanks
Sign In or Register to comment.