MIAC how to save and retrieve variables from EEPROM

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
Claes
Posts: 4
Joined: Thu Aug 25, 2016 9:07 pm
Been thanked: 1 time
Contact:

MIAC how to save and retrieve variables from EEPROM

Post by Claes »

Hi,
Could anyone help me with how to store variables to EEPROM, to be less sensitive for lost power supply.
And after wake-up I want to restore variables from the same memory.

I'm using Flowcode 7 and a standard 8bit PIC MIAC.

Thanks
Claes Ostberg

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIAC how to save and retrieve variables from EEPROM

Post by Benj »

Hello Claes,

Should be as easy as doing the following.

At the start of your program use the EEPROM read function to pull values from the EEPROM and save into your variables.

Then in your program when you write to a variable you can also write to the EEPROM location.

Beware though because the EEPROM erase/write limit is usually in the 100,000 range so if you change the value just once every second then you will potentially burn out the EEPROM location after 1.15 days.

Claes
Posts: 4
Joined: Thu Aug 25, 2016 9:07 pm
Been thanked: 1 time
Contact:

Re: MIAC how to save and retrieve variables from EEPROM

Post by Claes »

Thanks Ben,
Sorry but I am a newbie to this. I have tried to find the EEPROM function among MIAC Component macros, but without any luck.
Shall I include a c-code line in Flowcode, and in that case could you tell me the syntax?

Is there a list of all functions available in flowcode for the MIAC hardware?

Best Regards
Claes

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: MIAC how to save and retrieve variables from EEPROM

Post by LeighM »

Hi,
You need to include the EEPROM component onto your project, then use the Read and Write macros that it has.
eeprom.jpg
eeprom.jpg (37.15 KiB) Viewed 7090 times

Claes
Posts: 4
Joined: Thu Aug 25, 2016 9:07 pm
Been thanked: 1 time
Contact:

Re: MIAC how to save and retrieve variables from EEPROM

Post by Claes »

Thanks LeighM,
that worked.

/Claes

Post Reply