Shop OBEX P1 Docs P2 Docs Learn Events
More memory? — Parallax Forums

More memory?

XanfarasXanfaras Posts: 7
edited 2009-12-31 01:35 in BASIC Stamp
Hello all,

I'm pretty new to robotics and the BASIC stamp. Firstly, should anyone need to know, I am using the USB BOE stamp (link below). What I am trying to do, is to create a shortest-path maze-bot. The algorithm I have been developing is based on the A* algorithm (link below). Basically, the bot is supposed to visit each of the cells in the maze in order to determine the distance from the start. Then, the robot is able to head from finish to start using the shortest path by following the numbers in decreasing fashion back to start. With that said, I initially estimate for an nxn maze, I will need at least n*n*ceiling(log2(n*n)) bits for storing these cell distances. From what I understand, the BASIC stamp has 32 bytes of RAM, of which, 6 bytes are reserved for controlling the IO pins, leaving 26 bytes available. This would mean my maze size is limited to 6x6 (24.5 bytes) under minimum usage assumptions, which, quite frankly, is not going to happen.

Now, for my actual question(s), is there a good method one can employ to increase the available memory of the stamp? My initial thoughts were of some sort of chip expansion, although, further thinking led me to some other options, such as communication with a host (PC), or something along those lines. Perhaps I should be looking into another, less memory intensive algorithm? Then again, there is always the possibility that I've messed something up or missed something entirely, which is why I turn to those with more knowledge than I. Any thoughts, suggestions, or questions are happily welcomed and encouraged.

Thanks
Xan


My Board:
www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/294/Default.aspx?txtSearch=board+of+education+usb

A* Algorithm:
en.wikipedia.org/wiki/A*_search_algorithm

Comments

  • ercoerco Posts: 20,256
    edited 2009-12-29 20:15
    I think you're talking about the 32 bytes of RAM for varaiables & IO pins. Besides that, the BS2 has 2KB EEPROM for your program and WRITEing data. You can explore your maze and WRITE the distances measured on the fly into EEPROM and then read them back to calculate a best path.

    The BS2E has 5 switchable banks of memory like the BS2. If you can break your program into smaller subroutines, you can take advantage of that extra memory size for more program storage.

    Check out the Parallax website, it's in there!

    Best,
    erco

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • XanfarasXanfaras Posts: 7
    edited 2009-12-29 20:30
    What are the limitations on the EEPROM? I've read that some have limited read/write cycles; is there anything else? I'll have to check into this more, thanks for the idea.

    Xan
  • ercoerco Posts: 20,256
    edited 2009-12-29 20:48
    Something like a million read/write cycles. Only a problem if you accidentally get into an endless loop.

    And check the recent post "Downloading to program slots" for BS2E info.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • ZootZoot Posts: 2,227
    edited 2009-12-29 22:25
    It depends. Even a properly functioning program could be problematic. Say you write a value to the EEPROM once per second, after 1000000/86400 days you will burn out that location (i.e. 11.57 days, not long at all)

    Say you wrote a value every 10 seconds -- that's 110 days -- not even 6 months. Still not very long.

    On the other hand, if you are only writing a startup state, and your project resets, say, 20 times per day, it would take perhaps 1369 years till the location potentially burned out.

    So it's really a question of what you are doing and how often.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 12/29/2009 10:30:22 PM GMT
  • Mike2545Mike2545 Posts: 433
    edited 2009-12-29 23:09
    If a program has the potential for a loop of Write, I put in a control bit to allow/disallow the Write line » IF control bit = 1 then Write else skip...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike2545
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-29 23:34
    It's also possible to attach external RAM, EEPROM, or FRAM to a Stamp.· The minimum number of I/O pins needed is 3 (for SPI devices) or 2 (for I2C devices).· SPI devices are the easiest to use on Stamps that don't have the built-in I2C statements (like the BS2p/pe/px models).· There are Nuts and Volts columns that talk about this.· RAM normally erases when the power goes off.· EEPROM has the write limitations common to all flash memory (maybe 1,000,000 writes per location).· FRAM (from Ramtron) has essentially unlimited write cycles, is faster than EEPROM, but read cycles also involve a write cycle (done automatically).· The allowed # write cycles is large enough so that it's not really a limitation, even when you add in read cycles (because of the refreshes).
  • XanfarasXanfaras Posts: 7
    edited 2009-12-30 00:47
    I started looking at FRAM, and I found FM25256B-G made by Ramtron. Does this seem like it would do the job? It's SPI, although I have no true understanding of what SPI or I2C are besides that they are essentially ways in which the information is read/written. The number of IO pins shouldn't be a problem given how I expect to have things connected. If this is the type of thing I should be looking into, does anyone know of a good place to find information on its use (I already have a copy of the datasheet)?

    I'm new at this, so please bear with me. Thanks,
    Xan
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-30 01:54
    SPI uses the SHIFTIN / SHIFTOUT statements in Parallax Basic. There are examples of the use of smallish EEPROMs with a Stamp in some of the Nuts and Volts Columns and examples of other SPI devices (mostly Analog to Digital Converters and Real Time Clocks). The datasheets for these show what sort of data has to be transferred back and forth. Typically, you use a LOW statement to select the device, then send a command and address with SHIFTOUT statements, then either write with another SHIFTOUT or read with a SHIFTIN statement.

    You might look at datasheets for some of the SPI EEPROMs since they use the same commands and byte sequences as the FRAM since the FRAM is designed to be a drop-in replacement for an EEPROM. The EEPROM datasheets and application notes might be more thorough.
  • jeff2.0jeff2.0 Posts: 24
    edited 2009-12-30 06:22
    This thread scares me.

    I just did a project where the stamp runs constantly day after day, counting 30 mins then pulsing a pin high for a few secs, then back to counting again.

    I'm using a PAUSE 60000 inside a FOR 1 to 30 NEXT loop.

    I'm not going to burn it out any time soon, am I ?
  • ZootZoot Posts: 2,227
    edited 2009-12-30 06:30
    jeff2.0 -- Xanfaras' thread is specifically about using more memory space for saved info by using READ/WRITE to EEPROM location(s) on the Stamp (data that can be written/read and will still be there when power goes off). Unrelated to actually *running* the Stamp endlessly, so don't worry. See READ and WRITE in the Pbasic manual for more info if you are curious.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • jeff2.0jeff2.0 Posts: 24
    edited 2009-12-30 16:02
    Thanks Zoot,
    I was fearing that the program is "reading" the instructions and thus limited in life.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-30 16:10
    There's no limitation on reading from an EEPROM, only on writing to it. FRAM is different in that reading is destructive and the data has to be rewritten back to the memory array. This is fast and automatic. Because FRAM has much much higher write limits, this isn't a practical limitation.
  • ercoerco Posts: 20,256
    edited 2009-12-30 21:55
    Xan:

    Sounds like you're kinda new to everything. GREAT. Love your enthusiasm. If I were you, I'd wait on interfacing external memory and learning I2C or SPI. You can do everything you need to (perhaps on a smaller scale) with READ/WRITE statements and a BS2 or BS2E. Trust me, you have a long row to hoe just learning PBASIC, getting a robot rolling how you want and implementing your algorithm. But you're asking in the right place. These Forums (Robotics, too) put you in touch with some very savvy folks. And some hacks like me, too! [noparse]:)[/noparse]

    Don't bite off too much at once. Robotics ain't easy; savor those little victories!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • ercoerco Posts: 20,256
    edited 2009-12-31 01:35
    Xan: See my post at Easy Memory Increase? StampMem for a Parallax solution to increase memory and start scouring Ebay!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.