Sending data from Stamp to 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
·
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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
www.emesystems.com/BS2rs232.htm#MasterSlave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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
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 -->
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
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
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.
Thanks