Memory Storage Management

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Request group membership
By: Brandon Nimon, created: 2009-08-05 | updated: 2013-05-20

This object is designed to allow programmers (and/or end-users) to store values to EEPROM, referenced by name rather than just a number.

It is similar to a simple database system. The values can be stored in numerical byte, word, or long values. Strings, arrays, and stacks can also be stored to the EERPOM. All of the values are created, edited, and retrieved with a simple name.
All values can be edited and deleted. New in 2.0: deleted items' storage space can be reused, to reduce the wasted space.
 
This is great for storing user-created settings or values that need to be accessed at a later time with profile names or user entries. In the right hands, it can be used for just about any EEPROM application.
 
NOTE: a lightweight version of the object exists. It removes storing of strings, stacks, and arrays. It reduces the program size to about half of this object. 
 
NOTES:
  • Tables and values created by versions before 2.0 will be reset/erased when running this object for the first time.
  • This object supports and includes both the SPIN and PASM versions of I2C Drivers.
Original File Upload
AttachmentSize
MemoryStorageManagement2_0_2.zip66.95 KB

Comments

[originally posted by Jason Klein on 2010-07-20 21:36:00] I really like how this object allows for seamless use for storing data. The only problem is that I couldn't get it to work with arrays and stacks. Has anyone else run into this issue?

[originally posted by Brandon Nimon on 2011-01-03 09:03:32] To support arrays and stacks, you had to make your own use of the addr methods and the multiblock methods. I am working on a new version which will have built in methods for managing arrays and stacks. This support will be in version 1.3.3 and newer. I've already written it, I just need to test it.
 
[originally posted by Anonymous on 2012-01-12 06:34:54] Can you provide instructions on how to use this in its most basic form? After reviewing the demo 1 and demo 2 its still not clear how this operates. I think the demo has to much going on. Not sure where to sort through the busy demo to get to the heart of what is happening.
 
[originally posted by Brandon Nimon on 2012-01-12 09:08:56] In it's simplest form, you need to initialize the object with init (you only do this once, each time the Propeller is booted). Then use one of the create_X methods (eg: create_long(string("any name"), 5566)). This actually stores the value to the EEPROM. To get the value back, use one of the get_X methods (eg: get_long(string("any name"))) to get the value back. As long as the "name" in the string for both method calls are the same, the value is stored and accessed from the same location. Past that, it get's a little more complicated in an attempt to make things simpler :-). The check_edit_create_X methods are recommended when there is a possibility that the value may or may not already exist, So you don't have to keep track of using the create_X vs. edit_X methods. The get_dec method allows you get any stored decimal value, regardless of size (so you wouldn't have to track byte/word/long sizes). I know the object is a bit complicated (lots of PUB methods), it probably would help to start with the lightweight version (object 671) since it has less methods, and forces you to use the check_edit_create_X and get_dec.