Shop OBEX P1 Docs P2 Docs Learn Events
Non Volatile Variables — Parallax Forums

Non Volatile Variables

crgwbrcrgwbr Posts: 614
edited 2008-03-28 02:13 in Propeller 1
I am familiar with how to read/write data to the EEprom. My question is, if I write data to the address of a variable (in the boot EEprom), when the Prop is reset, will that data be copied in and the variable automatically assigned that value?

Thankss,
Craig

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My system: 1.6 GHz AMD Turion64 X2, 4GB DDR2, 256MB ATI Radeon Graphics card, 15.4" Widescreen HD Screen

I have a duel boot of Ubuntu Linux and Windows Vista. Vista, because it came with the PC, Ubuntu because I like software that works.

"Failure is not an option -- it comes bundled with Windows."

Use The Best...
Linux for Servers
Mac for Graphics
Palm for Mobility
Windows for Solitaire

Comments

  • JonathanJonathan Posts: 1,023
    edited 2008-03-27 23:14
    Nope. You need to read the data from the EEPROM and place it in the correct variable yourself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-27 23:22
    I beg to differ. If you write the value to EEPROM at the address occupied by the variable at runtime, the variable will be loaded with the initial value being what you wrote. When the program is written to EEPROM, the variables are initialized to zero (unless they are DAT variables with some other initial value). The whole EEPROM is copied as is to RAM on a reset with the initial values.

    Usually what you do is to use the address of the variable in RAM (@variable) as the EEPROM address as well when you write it.
  • Harrison.Harrison. Posts: 484
    edited 2008-03-27 23:24
    More information about the technique Mike describes can be found here: http://forums.parallax.com/showthread.php?p=678271 .
  • JonathanJonathan Posts: 1,023
    edited 2008-03-27 23:47
    Oops! Thanks for the correction Mike. Ya learn something every day... I'll go be quiet now. [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • crgwbrcrgwbr Posts: 614
    edited 2008-03-28 02:13
    Great! I was pretty sure it would work, but figured I 'd ask anyway.

    Thanks,
    Craig

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My system: 1.6 GHz AMD Turion64 X2, 4GB DDR2, 256MB ATI Radeon Graphics card, 15.4" Widescreen HD Screen

    I have a duel boot of Ubuntu Linux and Windows Vista. Vista, because it came with the PC, Ubuntu because I like software that works.

    "Failure is not an option -- it comes bundled with Windows."

    Use The Best...
    Linux for Servers
    Mac for Graphics
    Palm for Mobility
    Windows for Solitaire
Sign In or Register to comment.