Making 2 BS2 Modules work together
Andy "A Man With A Plan"
Posts: 45
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
-Andy
-Andy
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
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.
I'm trying to use two serial ports with the stamp as a go-between, and I keep loosing data.
All the work is done for you, both hardware and software,
if you look here.
http://forums.parallax.com/showthread.php?p=765140
humanoido