Shop OBEX P1 Docs P2 Docs Learn Events
Connecting Two STAMPS — Parallax Forums

Connecting Two STAMPS

John KauffmanJohn Kauffman Posts: 653
edited 2004-12-31 09:16 in BASIC Stamp
I have been unalbe to find posts that describes procedures to use together more then one STAMP with·physical connections (not RF communication).

Can a HIGH·output from STAMP1-Pin1 be connected directly to STAMP2-PIN1 and read as a HIGH input on STAMP2?

Do the two STAMPS have to have some type of common ground?

Can they have independent power supplies,·like one STAMP powered by a battery and the other a·wall wart?

Do all members of the STAMP family have the same HIGH and LOW definitions and thus can be connected? In other words, can different versions talk to each other?

Can I send data via SerOut to another STAMP to be read as SerIn?· ShiftIn / ShiftOut?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-28 23:15
    You must have a common ground for direct communications between two BASIC Stamp. SEROUT/SERIN is easily accomplished, and the Help file even shows how to use flow control so that no bytes get missed.

    This article will show you how: http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv81.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office


    Post Edited (Jon Williams) : 12/31/2004 6:51:43 PM GMT
  • stamptrolstamptrol Posts: 1,731
    edited 2004-12-28 23:26
    · Hi,

    ··· Yes, stamps can talk to each other.

    ·· You can network many together, but you have to do a bit of thinking about how the system will work. You can use the "open drain" parameter of SEROUT so that all stamps are 'listeners' and any single one can be the 'talker'.

    ·· Or, dedicate one as the master who talks on one pin while all the others listen on a second pin.

    ·· With careful coding, you can hook an output pin of one stamp to an input pin of another. However, I always put about 100 ohms in series just in case a pin inadvertantly gets switched to an output and gets put in the LOW state.

    ··· All stamps involved will share the negative of the power supply, regardless whether they are operating on batteries or wall power.

    ·· Have a look at the help files included with the explanation of SERIN and SEROUT. There are a couple of good examples to get you going. Also, the book "Serial Port Complete" by Jan Axelson includes many Stamp-based examples while explaining the details of plain serial and '485 serial communication systems.

    · Cheers
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-29 15:50
    The 'common ground' you speak of is usually included in the cable between the two Stamps.

    A 'recieving' Stamp usually sits in the 'SERIN' command, waiting for data, until the 'sending' Stamp does a SEROUT. This is the easiest approach. Getting a Stamp to act as a 'reciever' using SHIFTIN does not work.

    Yes, HIGH is the same signal state on all stamps.

    You want to be careful not to connect two 'drivers' together, when they are 'driving' in opposite states. This can destroy BS2 pin drivers due to over-current. You CAN do this, if you have a 220 ohm resistor between the drivers to limit the current. Thus, a 220 ohm serial resistor between the 'sending' BS2 and the 'recieving' BS2 is a good idea for safety.

    If you have 'some' distance (50 to 100 feet) the MAX232 driver chip is good. If you have lots of distance (less than 4000 feet) then a RS-485 transciever will be needed -- but you lose 'low-current' in this case.
  • cvtcvt Posts: 6
    edited 2004-12-31 09:16
    I built a network of PICs using a weird token system.

    I had a master chip, which was a master listner/talker/organiser
    all of the other chips in the network had a common SERIN and SEROUTand flow lines.

    master transmits *0001* (chip 1)
    waits 5ms trys again (3 more times), then trys the next chip.

    if the chip replys, it tx's *0010* (chip 2 for example)
    it then tx's the data destined for chip 2

    then to catch attention of chip2, the master now tx's 1010 (chip2 with top bit to say RX)
    waits 5ms, trys again, does so 16 times before dropping data and emergency shutdown
    if pic replys *1111* then data is tx'd

    the token is then the next pics turn, in this case, chip 2 gets the tx oppertunity, so master sends *0010*

    so on to satisfy all chips.

    admitadely, this was a very very complex network code, and since most of it was written in ASM, its no good here, but its a method for others to think about.


    this was an expansion on a 8 chip BS2e network I had.
    the 8 chip network was one master RX, and the others were just read shaft speed, TX result
    so they all had a serout line, and a trigger line, the master had a common serin line, and individual trigger line per PIC.
    I used flow control again as usual.
    trigger 1 go high
    wait 10ms
    tigger 1 low
    trigger 2 high


    incase your wondering why I have a wait in the codes, is because I didn't have the TX chips just wait to send.
    they waited 90ms, then re-analyzed the data, wether it be a 3 seconds to read shaft speed, or 5ms to read ADC, then it sat and waited 90ms again

    the master counted how many *strikes a chip received without receiving data, and if it was more than acceptable limit, the system would safety shutdown in the case of a broken wire or blown stamp.
Sign In or Register to comment.