Shop OBEX P1 Docs P2 Docs Learn Events
Beginner: Store Values in Propeller Memory — Parallax Forums

Beginner: Store Values in Propeller Memory

Chad1Chad1 Posts: 26
edited 2014-11-01 21:54 in General Discussion
Hi all,

This is probably an easy thing to do, but my mind gets foggy when it comes to dealing with registers and memory...

I'm trying to save the value of a parameter so that when power is shut off and turned back on, the parameter is loaded with the value it had before a power-down. In
a separate thread, I got a tip from someone in this community to "...write the value to the same address as your variable has in RAM and on boot-up the last saved value will be auto-loaded." This is perfect, but I don't know how to implement this in spin code. Can someone help me by writing a small piece of sample code which does this, or refer me to the appropriate section of the Propeller manual which explains this?

Thanks!

Comments

  • T ChapT Chap Posts: 4,223
    edited 2014-11-01 19:12
    Welcome. That is easy using eeprom. What size eeprom is on your board?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-11-01 20:29
  • Chad1Chad1 Posts: 26
    edited 2014-11-01 21:05
    Hey guys,

    I should have noted that I originally intended on storing the parameter's value in EEPROM, and I started a thread asking how to use the eeprom object file to do it (http://forums.parallax.com/showthread.php/157833-Beginner-Use-EEPROM-to-Store-Retrieve-Integer-Value). The response I mentioned (about storing the value in RAM) was from that thread, and for some reason after responding to it all activity died.

    I'd like to avoid using my EEPROM to store the value, per the response from the above thread. Any help I could get in doing that would be appreciated.
  • T ChapT Chap Posts: 4,223
    edited 2014-11-01 21:25
    The only way to store a value and recall it is to: Have the value written in your program at compile time or write the value to eeprom post compile. Ram does not store a value when power is removed.

    Jonnymac was referring to writing the value to the same location in eeprom, only he added that you don't need to write to upper eeprom. However, I suggest you learn how to write to eeprom above $8000 - $FFFF. This requires a 64k eeprom(512kb)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-11-01 21:54
    I'm going to lock this thread so that the discussion can continue in the other one that Chad1 started. With two threads open on virtually the same subject, things just get too confusing.

    -Phil
This discussion has been closed.