Shop OBEX P1 Docs P2 Docs Learn Events
How to make stamps talk to each other? — Parallax Forums

How to make stamps talk to each other?

gonweigonwei Posts: 14
edited 2006-12-20 16:09 in BASIC Stamp
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
448 x 201 - 10K

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-12-12 10:41
    Kevin -

    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 -->
  • gonweigonwei Posts: 14
    edited 2006-12-15 05:11
    Hi Bruce,

    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
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-12-15 05:55
    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 smile.gif

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • gonweigonwei Posts: 14
    edited 2006-12-15 06:09
    Hi Bruce,

    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]
  • Darth NigelDarth Nigel Posts: 1
    edited 2006-12-18 23:31
    I have a vague memory of needing to be careful when doing serin/serout between two Stamps on a common pin.
    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???
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-12-18 23:41
    There are sample circuits and programs shown in the PBasic help file for the Basic Stamp IDE. Just scroll to the bottom of the page for the SERIN & SEROUT commands in the command reference section.
  • Special_KSpecial_K Posts: 162
    edited 2006-12-19 01:23
    Sid....forum name NEWZED makes a Basic Stamp piggyback module. it lets two stamps talk to eachother and take up the space of one stamp. it rocks I have 3...
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-12-19 01:32
    Yes, if both BS2's try to 'talk' on the same wire at the same time, you can blow out the pin. A 220 ohm resistor in series will reduce the current enough to protect both pins.
  • Danny22Danny22 Posts: 29
    edited 2006-12-19 20:04
    Special-K, Does NEWZED have a website? The Basic Stamp piggyback sounds great.
  • NewzedNewzed Posts: 2,503
    edited 2006-12-19 20:09
    Danny, PM me with your e-mail address and I'll tell you about the Stamp piggyback.

    Sid

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Don't have VGA?

    Newzed@aol.com
    ·
  • SimeonJSimeonJ Posts: 2
    edited 2006-12-20 15:54
    Hello All! Happy Wednesday!!


    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
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-20 16:09
    SimeonJ,
    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.)
Sign In or Register to comment.