How to make stamps talk to each other?
gonwei
Posts: 14
Hi all,
Can someone shed me some light on how to make two stamps talk to each other?
I tried doing it by SEROUT from stamp1 to Pin A(of stamp1)·and connect the wire to Pin B(of stamp2) and do a SERIN at stamp2 and debug on terminal. But i couldn't get the actual data from stamp1, but got a junk value.
Can someone pls lend a helping hand?
Thanks in advance!!
Kevin
Can someone shed me some light on how to make two stamps talk to each other?
I tried doing it by SEROUT from stamp1 to Pin A(of stamp1)·and connect the wire to Pin B(of stamp2) and do a SERIN at stamp2 and debug on terminal. But i couldn't get the actual data from stamp1, but got a junk value.
Can someone pls lend a helping hand?
Thanks in advance!!
Kevin
Comments
You need to provide a common ground connection as well.
It's not clear from your supplied diagram whether these are the same model Stamp (such as 2 BS-2's) or whether they are two different models (such as a BS-2 and a BS-2px).
If they are the same, the above is all you need to do. If they are NOT, you may need to change the BAUDMODE parameters so that they agree. Common BAUDMODE values are shown in the PBASIC Help-file.
BTW - There are examples of connecting two Stamps in the PBASIC Referene Manual, under the topics SERIN and SEROUT.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Thanks for the information! yea i'm using two different stamps, but i've set them to a common baud. I've got 3 questions..
1) Does the common ground mean to connect both stamps' Vss via a wire? I'm sorry i'm kinda electronics idiot..
2) Does higher baud rate mean higher frequency of transmission and receiving? If not, what does it mean by higher baud rate, say 9600, as compared with lower baud rate, say 1200?
3) I've connected both Vss using a single wire, set common baud, the SERIN and SEROUT code are as follow:
SEROUT pin, 16468, [noparse][[/noparse]"!", data]
SERIN pin, 16624, [noparse][[/noparse]WAIT("!"), data]
I declared data as a WORD variable. But when i debug the data i can only get first 2 digit of the data, can i know wat's the problem with it?
Thanks in advance!
kevin
1) Yes, that's what common ground means.
2) Yes, that is correct. Higher baud rate = faster transmission/reception speed.
3a) Same means EXACTLY the same. How are the BAUDMODE parameters in these two statements (as you have supplied) the same?
SEROUT pin, 16468, [noparse][[/noparse]"!", data]
SERIN pin, 16624, [noparse][[/noparse]WAIT("!"), data]
They sure look DIFFERENT to me!
3b) Data transmission on the PBASIC Stamp is bytewise. Try sending the data as variable_name.HIGHBYTE, variable_name.LOWBYTE as two individual bytes (and receive them that way as well) and see if things improve. There are also examples in the PBASIC Reference Manual, and the PBASIC Help File, as I remember.
I can't answer any question about DEBUG without seeing the DEBUG statement. My crystal ball is foggy today
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Real thanks for your reply! The baud rates are different because i'm using 2 different stamps, one BS2 and one BS2sx. Thanks for your correction, I've finally got the data transmitted from stamp 1 to stamp 2 correctly displayed in the debugging terminal! It's the addition of highbyte and lowbyte to my code. However i'm still not too sure about how this trick make the whole thing works, but i'll look into the Pbasic help file as you mentioned. Thanks again!
kevin [noparse]:)[/noparse]
Other than the usual sequencing (master/slave) stuff, I remember some warning about bad things happening if both stamps tried to write at the same time???
Is this just a hallucination brought on by old age or do you have to worry about some form of opto-isolator or resistor pullup or something???
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Don't have VGA?
Newzed@aol.com
·
I'm completely new to "chip programming". I am a developer for a software company and this has caught my interest...
Would I have the ability to feed data from a laser range finder that i bought from a store (with digital display) into a BS2 chip?
And, my second question, this may be for a different forum, but how capable is the BS2 of math functions? is there a better chip for all of this?
Thanks in advance for any help I may get!
Simeon
If you have a question or comment unrelated to the initial thread subject, feel free to start a new thread in what seems to be the appropriate forum section. It's a much better way to get your question answered and makes it easier for others to benefit from what you learn.
1) Regarding the laser range finder. It's impossible to tell without more information. Does it have some kind of external output? Are you
asking about somehow "tapping" into the display or what?
2) The BS2 is a 16 bit integer processor. You can do some multiple precision arithmetic, but it's slow. Tracy Allen at emesystems.com has
quite a few web pages on doing arithmetic with the BS2. Have a look at his site. There are external arithmetic chips that can be used with
the BS2 to do 32 bit integer and floating point arithmetic including transcendental functions (sqrt,sin, etc.)