Shop OBEX P1 Docs P2 Docs Learn Events
Intercommunication between stamps — Parallax Forums

Intercommunication between stamps

Donald WheelerDonald Wheeler Posts: 10
edited 2006-04-18 20:44 in BASIC Stamp
· My problem is this: I need two BS2px's to communicate over serial in a reliable manner. I have tried two different but very similar methods, both using direct connection, flow control and the SERIN/SEROUT commands. The issue here is timing. The two programs have become somewhat complex, and the timing needs of the SERIN and SEROUT commands make this method unreliable. What other method can I use that will not have timing problems (examples would be appreciated)?.
· Thank you,
···· RT

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-18 20:39
    There does exist a nice, small (8-pin) 'sMT' simple multi-tasking co-processor (http://www.rhombus-tek.com/co-processors.html). This will provide an SPI-interfaced serial 'mailbox', so your program can be doing something else most of the time, while the mailbox recieves the RS-232.

    There's also examples on the website as to how to use the module for a task-switching 'tick', so you can implement a BS2-based state-machine multi-tasking.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-04-18 20:44
    If you don't add some external component, then your program will have to have a 'rendezvous' section of code, where one processor 'waits' for a little while for the other one to signal it -- typically by raising a pin high, which is acknowledged on the other end by raising ITS pin high, then the first processor lowers its pin and enters the SERIN. When the other processor sees that pin drop, it knows the first processor is entering the SERIN. It waits 1 mSec, then sends the data.

    You'll still have to work out possible race conditions, of course.
Sign In or Register to comment.