Shop OBEX P1 Docs P2 Docs Learn Events
newbie question, preserving variable values — Parallax Forums

newbie question, preserving variable values

paul6502paul6502 Posts: 7
edited 2008-03-03 16:41 in Propeller 1
I would like my prop program to set certain variable's value and then have that same value (stored in eeprom) when the program stops and restarts. (think of an .ini file in DOS). Is there a good way to do this in Spin? Thank You

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-03 16:41
    Prop programs are copied from EEPROM to RAM in order to execute. The entire EEPROM is copied including the initial content of variables (set to zero when downloaded with the Propeller Tool). You can write values to the EEPROM locations that correspond to the variables and these values will be loaded when the Propeller starts up.

    Essentially, if you have a variable "test", you would write your value to the location "@test" in the EEPROM. You can use any of the EEPROM writing routines to do this, for example "Basic_I2C_Routines" in the Object Exchange.
Sign In or Register to comment.