Best way to modify a variable with out storage

Posted on
  • Hello,

    I need to set some variables. Those variables are positions of motors that I use in my project. I want to set those variables because I want to continue work if device restarts somehow.

    I'm setting the devices position after each step. When stepping job done, I use save() function to save current position.

    But this way causes some conflicts, I think it doesn't only change value and save it. It appends some code after my pure code, then saves it.

    Are there a better way to set variables without using an external storage device?

  • ...I guess not... just go for the @DrAzzy stuff, he put a lot into... and it is working just fine... and it is part of the release. 'Gluing' a few legs onto your board and you are there with robust reliability...
    All these three conversations A, B, and C provide you with plentiful useful information.

  • @allObjects I'm using STM32F4 Discovery, I can't see any eeprom spesification in the brief : http://www.st.com/st-web-ui/static/activ­e/en/resource/technical/document/data_br­ief/DM00037955.pdf

    So, I need to buy and plug an eeproom module, then code on it. Am I right?

  • Yeah - sadly the STM32's don't have builtin EEPROM.

    I recommend AT24 eeproms - the both the chips and the modules are cheap and abundant. http://www.espruino.com/AT24 (info on AT24 and Espruino)
    http://www.ebay.com/itm/171325005348 (this is the kind of module I use, if I'm not soldering it into the prototyping area)

  • Yes, save() will save the state of the program, but it'll also re-run onInit(), so you'd have to take account of that somehow.

    EEPROMs are probably the most sensible solution (the OneWire ones are quite easy to work with as well) . Other options are:

    • to use an SD card (obviously it's built into the normal Espruino Board, but you'd have to wire it up)
    • to use the STM32F1Flash module to access Espruino's flash memory directly and save all your information to your own page. Again, that won't work for you though because you're using the F4
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Best way to modify a variable with out storage

Posted by Avatar for fobus @fobus

Actions