Shop OBEX P1 Docs P2 Docs Learn Events
Saving setting with a prop — Parallax Forums

Saving setting with a prop

crcordillcrcordill Posts: 29
edited 2009-12-28 18:57 in Propeller 1
Hey guys, Happy Holidays.

What I want to do is to be able to save settings on my prop. So lets say that I have a device with limits where I want a servo to stay between. I don't want to make those a constant, because I want to be able to change them for varying conditions. However, I'd also like the prop to "remember" those limits when I turn it on again. Is this possible easily? How would one go about doing this? Thanks for your help and for looking.

Comments

  • LeonLeon Posts: 7,620
    edited 2009-12-26 20:18
    Use a bigger EEPROM and save the values in the upper part. There is code in the Obex for it. The Propeller Tool won't know about it, so you can safely update the boot code without affecting the code in the top half.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • JonnyMacJonnyMac Posts: 9,208
    edited 2009-12-26 21:30
    As long as you don't reprogram the Propeller you can save it in the normal boot EEPROM, though you'll want to do so in the upper end away from your program code. This assumes, of course, that your program doesn't fill 32K.
  • crcordillcrcordill Posts: 29
    edited 2009-12-26 22:45
    That sounds like a great idea. I looked at the OBEX and am having a hard time making heads or tails. Any more hints?
  • hover1hover1 Posts: 1,929
    edited 2009-12-26 22:52
    You can look at:

    http://obex.parallax.com/objects/539/

    or

    http://obex.parallax.com/objects/26/

    to get an idea.

    Between those two, you should be good to go.

    Jim
    crcordill said...
    That sounds like a great idea. I looked at the OBEX and am having a hard time making heads or tails. Any more hints?
  • JonnyMacJonnyMac Posts: 9,208
    edited 2009-12-27 01:48
    You need an I2C object -- there are several (including one by yours truly, but mine requires pull-ups on both lines [noparse][[/noparse]sda, scl] which are not on all pre-built Propeller boards).
  • hover1hover1 Posts: 1,929
    edited 2009-12-27 02:19
    Sorry Jon,

    I did not include your Object.

    http://obex.parallax.com/objects/528/

    Cant' go wrong with one of the three.

    Jim
    JonnyMac said...
    You need an I2C object -- there are several (including one by yours truly, but mine requires pull-ups on both lines [noparse][[/noparse]sda, scl] which are not on all pre-built Propeller boards).
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-12-27 03:01
    I use a normal variable which are all loaded from the eeprom at boot so by default they are zero. By writing into the eeprom at the address of the variable such as "i2c.eewr(@resets,resets)" you will change the default value of the variable that is loaded automatically at boot time. So, no special location is required and no special reading of the eeprom is required is either.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-27 03:18
    Ditto Peter's advice. If the setting value is a VAR or DAT variable, its RAM and EEPROM addresses are the same. Moreover, the Prop does not verify the EEPROM's checksum on startup, so you can overlay any value you want at the variable's EEPROM location.

    -Phil
  • crcordillcrcordill Posts: 29
    edited 2009-12-28 18:57
    The last two posts seem like the best route. Pete, what exactly do I need to put into the following to make it work: "i2c.eewr(@resets,resets)" ? Do I need some extra code for the i2c.eewr driver? Thanks for your help.
Sign In or Register to comment.