chipKIT® Development Platform

Inspired by Arduino™

Saving and reusing variables after power turn off

Created Sun, 03 Nov 2013 17:04:58 +0000 by hdphilip


hdphilip

Sun, 03 Nov 2013 17:04:58 +0000

Ok, maybe the title seems odd, but here's what i'm trying to figure out:

let's say you have a variable, and this variable is the result of a rotary encoder input, it could represent a light level, volume level or just about anything.

What I'd would like to do is be able to store the value of this variable so, when I power on the chipkit, my previous settings have been retained in memory.

any ideas of where to google?

Thanks

Philip


majenko

Sun, 03 Nov 2013 17:30:58 +0000

Traditionally you'd achieve this using EEPROM in the smaller microcontrollers. The PIC32 doesn't have EEPROM though, but it does have plenty of flash, so the EEPROM library emulates EEPROM by using flash instead.

Alternatively you can use an external EEPROM or flash chip if you want to keep it completely separate from the main chip. That would protect it against losing data when you reprogram, etc.

The EEPROM library is part of MPIDE. Check the Examples menu.


hdphilip

Sun, 03 Nov 2013 17:53:14 +0000

Thanks majenko,

I'll look into the eeprom examples.

oh, on a side note, i just received my 2.2 TFT Lcd, haven't hooked it up yet, but it's pretty nice!

Philip

EDIT:

works!!!