Connect with us

Sharing memory

Discussion in 'Electronic Basics' started by eromlignod, Mar 8, 2007.

Scroll to continue with content
  1. eromlignod

    eromlignod Guest

    Hi guys:

    I'm an ME and I have an application where I'd like to use two Basic
    Stamp microcontrollers working together. One is the main processor
    that runs the show and does calculations; the other is a dedicated
    slave that constantly distributes a series of 16-bit numbers to
    various devices in a continuous, timed loop. The first processor
    calculates what these numbers are based on feedback sources.

    The reason I use a dedicated second processor is that its stream of
    numbers can't be interrupted...it has to provide a continuous series
    of values on a clock. The problem is that I can't even interrupt it
    long enough to pass numbers to it from the other processor without
    messing up the sequence.

    What I'd like to try (if possible) is to share the same memory between
    the two MCU's. So the first Basic Stamp is calculating values and
    storing them to memory and the second Basic Stamp is using them as if
    they were in its own memory bank simply by referring to a value by
    variable name (or address??...I don't know).

    Is this possible and, if so, what would be a good way of going about
    it? I'm also open to alternate suggestions to solve the problem
    including using a different processor (I would like to avoid investing
    in another development kit or chip burner if possible though).

    Thanks for any help you can provide.

    Don
     
  2. Greg Neill

    Greg Neill Guest

    google: dual port ram
     
  3. Noway2

    Noway2 Guest

    Normally, I would implement a periodic update on a timer interrupt and
    make the interrupt a sufficiently high priority. If your timing is so
    tight that you can't do this as you seem to imply in your post, it would
    make a strong case for either your processor not being fast enough or
    your design methodology is highly inefficient.

    I can understand why you would want to avoid the costs associated with
    different development kits, programmers, and the increased learning
    curve. However, you need to carefully weigh these costs versus those
    incurred by continuing to implement an inadequate or incorrect design.
     
  4. Chris

    Chris Guest

    Hi, Don. I'm guessing from the description of your problem that
    you're using two BS2-ICs, which have 16 I/O pins. You might want to
    look into the Parallax BS2p40-IC. It has 32 I/O pins, and runs at the
    same clock speeed as the BS2. This will allow you to retain nearly
    all of your investment in programming and debug time, and you can
    duplicate your BS2 development board for the BS2p40-IC with little
    effort. This way you can output your 16-bit number and do everything
    you're doing now with almost no changes (except you'll have time to
    relax for a change).

    The Basic Stamp isn't set up to share memory -- the serial EEPROM is
    meant to store the tokenized program, which needs to be continuously
    accessed. Any external memory is going to be an I/O hog, unless you
    use serial. If you are spending time bit-banging an external serial
    EEPROM from I/O pins in Stamp BASIC, not to mention arbitrating
    between two Stamps, your already slow setup will get even more bogged
    down.

    Good luck, and feel free to post again if this isn't satisfactory --
    there are many other solutions, depending on the specifics of your
    problem. If you decide to post again, please include some specifics
    -- such as which Stamp you're using, how many I/O you need, and a
    sense of what you're doing with your project.

    Chris
     
  5. jasen

    jasen Guest

    possible, but not easy, or even practical.

    t'd probably be much easier to use a more capable processor for sending
    out the numbers, have it use a interrupt routine to send out numbers (so
    that they flow steadily) and interact with the other processor in its
    spare time.


    Bye.
    Jasen
     
  6. Rich Grise

    Rich Grise Guest

    If your "master" is fast enough, you could write a ring buffer so that
    the next item of data is waiting for the slave to pick it up. You'd need
    some handshaking, so that the master knows when it's time to reload
    the buffer, or pause if you're going too fast, but it could be done
    with no additional parts, just software.

    A ring buffer is just a chunk of memory that's accessed one item
    after another, and the index wraps from the end to the beginning;
    the master writes to it, and when the slave is ready, it requests
    a byte (or whatever) that's guaranteed to be ready to be picked
    up. The master would manage the "write" and "read" pointers and
    so on.

    Good Luck!
    Rich
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-