communication between stamps
raulduke1011
Posts: 17
I am currently working on a project where I have two bs2sx on development boards powering the same robot. One is in charge of getting input from a PING, 2 IR, and PIR sensors. The second processes the input from the first and powers the motors, handles speaker and lights, etc. The idea is to have the first controller handle gathering of all sensory input and the second controller to serve as the brain in processing the sensory input and acting accordingly along with random behaviors of its own. I have the communication between the two working but I'm quite sure that's it's the least efficient way of doing so.
I currently have the two connected using three wires (3 pins on each) and send the message as 1 of 8 possible numbers using binary.
Ex:
001(low 0: low 1: high 2) = wall hit by right sensor
010 = wall dead ahead
011 = wall hit by left sensor
Can anyone offer some advice as to how I can make this more efficient. It is also a kind of cluttered how I have to bunch all of the sensors together and use a chart to decode the input when received by the brain.
Thanks.
I currently have the two connected using three wires (3 pins on each) and send the message as 1 of 8 possible numbers using binary.
Ex:
001(low 0: low 1: high 2) = wall hit by right sensor
010 = wall dead ahead
011 = wall hit by left sensor
Can anyone offer some advice as to how I can make this more efficient. It is also a kind of cluttered how I have to bunch all of the sensors together and use a chart to decode the input when received by the brain.
Thanks.
Comments
this will allow you to send and receive a lot more data, you can send strings or numbers and communication is bi-directional. The best part is that your current configuration will word for a serial connection and you have an I/O line to spare.
take a look at the SEROUT and SERIN commands, it should be really easy to modify the demo code for your purpose.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster
DGSwaner
They're more easy to remember, include the entire alphabet
and graphic characters, and have many combinations.
I recommend starting with a two wire serial net, with flow
control. This enables the highest baud rates and maximum
reliability. Remember to hard wire the 1K resistor on the
Tx/Rx line. One port is Tx/Rx and another is Fpin flow
control. Fpin is pulled to ground through a 10K resistor.
For your robot development, you can put the sender output
reporting on the debug screen and the receiver on the LCD.
Also the TTL signal gets the inversion code.
humanoido
Could you please send some details and code so I can try this.
Thank you
L Sutherland
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·Right_Uderstanding, Attitude, Speech, Action, Livelihood, Effort, Concentration, and Awareness
code samples and hardware wiring diagrams to set up and try
out. I simply used the latest version of the Basic Stamp manual
posted at the parallax web site and also read the information in
the help files within the Basic Stamp Editor. I'm still developing
highly specific app code for publication and will release it when
the project is complete. There are already numerous threads in
the Parallax forum posting such applications with code and
wiring details. This should get you started in the right direction.
Below you can find the posts for the software code and wiring
circuits. The nv81 is probably exactly what you're looking for.
www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/CategoryID/9/List/0/SortField/0/Level/a/ProductID/9/Default.aspx
www.parallax.com/tabid/477/Default.aspx
www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/col/nv81.pdf
humanoido
Thank you
L Sutherland
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·Right_Uderstanding, Attitude, Speech, Action, Livelihood, Effort, Concentration, and Awareness