Shop OBEX P1 Docs P2 Docs Learn Events
Connecting 2 stamps — Parallax Forums

Connecting 2 stamps

blacksheep45blacksheep45 Posts: 41
edited 2009-01-14 16:39 in BASIC Stamp
hello,

Does anyone·know how i would be go about physically connecting two bs2pe stamps together?
Also·what code i would need to use to get it to run through the programs on the 1st stamp and then go onto run·the programs on the second stamp.

Kind Regards

Shaun

Comments

  • dandreaedandreae Posts: 1,375
    edited 2008-12-18 15:52
    You can use the SERIN/SEROUT commands for this project.· On pages 410 to·413 of the "BASIC Syntax and Reference Manual" it will show you how to connect the two stamps and give you a sample code.· Here is a link for the download of the text:

    http://www.parallax.com/Store/Books/BASICStamp/tabid/168/CategoryID/42/List/0/Level/a/ProductID/143/Default.aspx?SortField=ProductName%2cProductName



    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • SRLMSRLM Posts: 5,045
    edited 2008-12-18 16:33
    I connected two stamps (a BS2px and BS2) together with an EEPROM in between, and a flag line direct. The slave wrote to the EEPROM, then when the master was ready it read the data. It worked, but wasn't very efficient.
  • blacksheep45blacksheep45 Posts: 41
    edited 2008-12-18 17:22
    Dave,

    Would connecting the stamps in this way allow me to run through all the programs·on the 1st stamp and then go onto the programs on the 2nd stamp?

    Regards

    Shaun
  • dandreaedandreae Posts: 1,375
    edited 2008-12-18 17:43
    In this configuration you can SEROUT an ASCII character from one stamp and·use the "wait" modifier·using the SERIN command on the other stamp.· Based on the character sent, you can run a·specific subroutine.· I hope this helps.



    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Parallax Tech Support·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-12-18 18:26
    SRLM,

    That's an interesting approach; I like it! A serial SRAM like this one or this one would make the process more efficient — at least between Stamps in the BS2p family — and eliminate any write-durability concerns. Not only does it allow the receiver to retrieve the data at its leisure, but it also has the potential to be faster than a direct serial link.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 12/18/2008 6:32:17 PM GMT
  • HumanoidoHumanoido Posts: 5,770
    edited 2008-12-18 21:56
    You may want to use a very simple one wire interface
    using only one port Rx/Tx per stamp. The PBASIC code is
    very simple too. This project software goes up to 20 stamps,
    but you can start with two and it works just fine. There's an
    added resistor as seen in the circuit diagram.

    http://forums.parallax.com/showthread.php?p=765140

    humanoido
  • blacksheep45blacksheep45 Posts: 41
    edited 2008-12-29 15:16
    If i wanted to connect 2 stamps together using the professional development board would i simply just put the second stamp on the breadboard and then·connect the pins used, together,·via a resistor. Or would this blow one of the stamps?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-29 15:30
    By putting resistors (like 220 Ohm) between Stamp pins, you will protect the Stamp pins from accidentally making them both outputs of opposite states (one HIGH, one LOW). Depending on how you want to use the I/O pins, this might not work since some circuits might need more current than can be supplied through the 220 Ohm resistors. It all depends on how you plan to use the I/O pins. For most cases where you're making them both inputs, this scheme will work just fine. If you're using them as outputs, it depends on the rest of the circuit. If it's a logic output (connected to some logic input somewhere), you're probably fine.
  • $WMc%$WMc% Posts: 1,884
    edited 2009-01-02 01:09
    blacksheep45

    If all You need is "STAMP1" to run out its code or exercise then move on to STAMP2 then You dont really need a COM link.Just an I/O pin to another $STAMP to say "Its Your Turn"-$STAMP2.

    If You can be more specific on what Your after, I think this post will help You

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there·········································· E=$WMc%2
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-01-02 01:40
    I put up a smaller project version using only two stamps.
    While it uses a Parallax Super Carrier Board and BS2px
    board, you could do the same with a single stamp on the
    Parallax Professional Development Board.

    http://forums.parallax.com/showthread.php?p=765140

    humanoido
  • blacksheep45blacksheep45 Posts: 41
    edited 2009-01-07 10:21
    Hi,

    I am using a parallel LCD and i was wondering if the Serin/Serout commands would work with this or if there was an alternative for parallel LCDs.

    Kind Regards

    Shaun
  • UghaUgha Posts: 543
    edited 2009-01-07 12:55
    A parallel LCD will absolutely work on the stamp... but in my opinion its a bit of a pain.

    The best bet is a serial LCD which only takes 1 pin and you do use SEROUT to send information.

    A good way to do it is to use a normal parallel LCD with a serial "backpack".

    One that I've had a great deal of success with is the #117 LCD backpack by Peter H. Anderson.
    (www.phanderson.com)

    Mr. Anderson sells the #117 in kit form, kit with a nice LCD and a fully assembled version with an LCD.

    If you have any soldering skills, I recommend the kit form and some perf board to build your own backpack...
    its pretty darned easy once you figure out the instructions he sends (they are hand written).

    If you can't solder, then just get the #117 in assembled form with a LCD. It looks nicer that way anyways.

    You can also often find the #117 on ebay, sometimes assembled, sometimes not.

    If you need help with the schematics/instructions then feel free to drop me a PM.
  • blacksheep45blacksheep45 Posts: 41
    edited 2009-01-09 12:07
    Hello,

    I was wondering how i would go about connecting two bs2p40 chips using a parallel LCD as i am unsure if the serin/serout commands will still work at all or in the same way, could someone please help me.

    Kind Regards

    Shaun
  • SRLMSRLM Posts: 5,045
    edited 2009-01-09 16:42
    You can use a pin as a flag. Simply have each uC connected to the LCD and a pin each. When one wants to write to the LCD, it pulls the pin high and writes. When done, it pulls it low. The other one cannot write when the pin is high, but when it's low it does the same process.

    Alternately, you could just hope that they don't conflict. If there are relatively infrequent updates, you can just have then send the commands as if the other one weren't there.
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-01-13 03:56
    If you want a simple setup, just connect the parallel LCD to
    one stamp, and connect the two stamps together on another
    pin. You can send serial commands back and forth between
    stamps and one stamp can update the parallel LCD. The pin
    isolation assures there is no conflict.

    humanoido
  • blacksheep45blacksheep45 Posts: 41
    edited 2009-01-13 15:30
    SRLM,

    Would you be able to show me some example code for this as i have tried using some of my own code but i cannot get this to work.

    Kind Regards

    Shaun
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-13 15:36
    Post your code (as an attachment to your message) and your setup (schematic) and explain what happens (if anything). Use the Post Reply button and the Attachment Manager rather than Quick Reply.
  • blacksheep45blacksheep45 Posts: 41
    edited 2009-01-13 16:41
    The Pins on the LCD are, from top to bottom

    E
    RW
    RS
    DB4
    DB5
    DB6
    DB7

    On the·BS2p40 the fifth pin from the left on the bottom row is pin 0.
    Also the Master chip is plugged into a parallax PDB.

    Hope someone can help.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-13 17:12
    You cannot connect two Stamps together the way you have without likely damaging them. As I mentioned in an earlier message, you need something like a 220 Ohm resistor in all of the leads between the two Stamps. Because the LCD has all inputs, you don't need the 220 Ohm resistors there.

    Your programs look like they're nearly identical. That means that both Stamps are trying to control the signals to the LCD at the same time and, since the timing between them isn't perfect, one Stamp will try to make an I/O pin HIGH at the same time that the other Stamp will try to make the I/O pin LOW and you'll have a short circuit that may damage one or both I/O pins.

    On the serial I/O connection, even if only one Stamp transmits at a time, there are programming errors that can occur and the same thing will happen (I/O pin burnout).
  • SRLMSRLM Posts: 5,045
    edited 2009-01-13 17:22
    The first block of code is the slave module. It's a regular BS2 module, so it needs the extensive I2C routines.
    'Store Data in external EEPROM
    Store_Data:
      DO UNTIL IN2 = 0
        DEBUG "Cannot check EEPROM: line high", CR
        PAUSE 1
      LOOP
      HIGH line
      ' Writing Section
      GOSUB I2C_Stop
      GOSUB I2C_Start
      GOSUB Control_Byte_Write
      GOSUB Addrs
      GOSUB Write_Data
      GOSUB I2C_Stop
      LOW line
    RETURN
    
    



    The second is the code on the master, which was a BS2px. With this module I was able to have a nice I2C routine to use.

    DO UNTIL IN2 = 0
      DEBUG "Cannot check EEPROM: line high", CR
      escape = escape + 1
      IF(escape = 255) THEN
        DEBUG "Line is high. Ending program."
        END
      ENDIF
      'PAUSE 1
    LOOP
    HIGH line
    FOR counter = 10 TO 42
      'get data
      DEBUG "E"
      location = offset + counter
      I2CIN SDA, $A1,location.HIGHBYTE\location.LOWBYTE, [noparse][[/noparse]value]
      DEBUG DEC3 value, CR
      'Store data
      PUT location, value
    NEXT
    LOW line
    
    



    I set the EEPROM up as expected on one of the BOE boards, and used a jumper on the expansion I/O pins (that strip between the BS2 and breadboard) to get the other module to talk. Note that this method works, but it's really quite slow.
  • blacksheep45blacksheep45 Posts: 41
    edited 2009-01-14 09:20
    Hi Mike,

    Sorry, i do have a resistor connecting the 2 stamps but i forgot to put it in the drawing, it is a 1k resistor, is this to high?

    Kind Regards

    Shaun
  • blacksheep45blacksheep45 Posts: 41
    edited 2009-01-14 16:39
    Hi Mike,

    Would you be able to show me some code that would allow the 2 stamps to communicate with each other the way they are currently connected, as i am really struggling to get the stamps to communicate with each other.

    Kind Regards

    Shaun
Sign In or Register to comment.