Shop OBEX P1 Docs P2 Docs Learn Events
Stamp Timing Puzzle — Parallax Forums

Stamp Timing Puzzle

HumanoidoHumanoido Posts: 5,770
edited 2009-07-02 22:48 in BASIC Stamp
The stamp BS1 can only do one thing at a time. Each of 10 stamps need to report their ID number (using serout), while the others listen (using serin) and write all the numbers to eeprom. Each stamp does not know the other stamps. The ID numbers are approximately 0, 17, 28, 40, 49, 70, 89, 111, 116, 128.

I was thinking about some internal timer, and each computer talks in their time slot, and listens in the remaining time slots. Is there anything internal to the BS1 that can be read as a timing tick, while the program is running? I really don't have the resources to add ten clock chips although that would be a perfect solution.

Maybe there is a much more simple solution?

humanoido

slot   1        2        3        4        5        6        7        8        9        10
id     0        17       28       40       49       70       89       111      116      128
bs1    x
bs2             x
bs3                      x
bs4                               x
bs5                                        x
bs6                                                 x
bs7                                                          x
bs8                                                                   x
bs9                                                                            x
bs10                                                                                    x

Comments

  • dev/nulldev/null Posts: 381
    edited 2009-07-02 09:23
    The Stamp chips do not have virtual timers that you can use. It's either timing chips or some other solution.

    I had a similar problem, I needed a common "timer service" on my serial bus.

    I set up a Javelin as a timer master. From my stamps I send "resettimer(x)" and "gettimer(x)" via SEROUT to the Javelin, which responds with elapsed time.

    Currently I have three timers going, but you could in principle have unlimited numer of timers, with the Timer() object .
    This is great because it allows me to have "virtual" timers going while I do my Stamp processing.
    It might not suit your needs, but I thought I'd tell you anyway.

    --
    dev/null
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-07-02 11:36
    dev/null:

    Thanks for the idea. I will create a fuzzy timer, set and controlled by the absolute computer. A precise timer is not necessary so a virtual fuzzy clock will work just fine. No parts necessary. The key here is not to poll the VR Clock but rather have the clock controller send out flags. Sort of like tuning your radio to WWV and listening for the incremental mark.

    humanoido
  • achilles03achilles03 Posts: 247
    edited 2009-07-02 20:46
    What do you mean "does not know the other stamps"? Do you mean that the IDs can vary? Or do you just mean that since they're on the same line, there's no way for them to know which stamp is transmitting without an identifier?

    This solution would work if the other stamps can be programmed with the IDs of the other stamps on the line, then have them go in sequence like this:
    STARTLOOP:
    SERIN ID, data
    WRITE ID, data to eeprom
    if ID = target ID THEN TRANSMIT
    GOTO STARTLOOP

    TRANSMIT:
    pause 1
    serout ID, data
    goto STARTLOOP

    Each stamp has a target ID, which is the ID of one of the other stamps. Also, instead of a target ID, you could just use a range.

    Hope that helps,
    Dave
  • dev/nulldev/null Posts: 381
    edited 2009-07-02 22:48
    I think he is sharing the IO line and using flow control. So he's using only 1 pin for receive transmit...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    dev/null.
Sign In or Register to comment.