PDA

View Full Version : Saving setting with a prop



crcordill
12-27-2009, 03:07 AM
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.

Leon
12-27-2009, 03:18 AM
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

JonnyMac
12-27-2009, 04:30 AM
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.

crcordill
12-27-2009, 05:45 AM
That sounds like a great idea. I looked at the OBEX and am having a hard time making heads or tails. Any more hints?

hover1
12-27-2009, 05:52 AM
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?

JonnyMac
12-27-2009, 08:48 AM
You need an I2C object -- there are several (including one by yours truly, but mine requires pull-ups on both lines [sda, scl] which are not on all pre-built Propeller boards).

hover1
12-27-2009, 09:19 AM
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 [sda, scl] which are not on all pre-built Propeller boards).

Peter Jakacki
12-27-2009, 10:01 AM
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)
12-27-2009, 10:18 AM
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

crcordill
12-29-2009, 01:57 AM
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.