EEProm Initialize Help?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Collimare
Posts: 19
Joined: Thu Mar 08, 2012 9:34 pm
Been thanked: 2 times
Contact:

EEProm Initialize Help?

Postby Collimare » Wed Mar 14, 2012 4:07 pm

Ok I have all the functionality now working well (thanks to Martin) and would like to store a variable into EEProm.

I obviously need to program an initial value either when the part is burned, or at the very first power up and then check to see if it has been changed and use the new value each time the device is restarted.

Does anyone have a simple example routine for this?

Thanks, Howard
These users thanked the author Collimare for the post:
medelec35 (Wed Mar 14, 2012 7:11 pm)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8420
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2405 times
Been thanked: 3437 times
Contact:

Re: EEProm Initialize Help?

Postby medelec35 » Wed Mar 14, 2012 7:13 pm

Hi Howard,
What I do is use one additional address to store a key value e.g 22 when I write to EEPROM

Then if the chip is reset and I want to read my stored data from EEPROM:
I first read the key value, if its 22 then I read from the EEPROM location that contains my stored data.

If value = 22:
Yes then read EEPROM
no: //Don't bother reading since EEPROM has not been wrote to yet.

Hope this helps.

I have explained about a similar thing here:
viewtopic.php?f=29&t=9137&p=29062&p28950#p28950

If your still stuck I can assist you further.


Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

Collimare
Posts: 19
Joined: Thu Mar 08, 2012 9:34 pm
Been thanked: 2 times
Contact:

Re: EEProm Initialize Help?

Postby Collimare » Wed Mar 14, 2012 11:45 pm

Hi Martin,

Thank you again for the help. I now have it working!

I have noticed a 3 second delay after write in most of the examples. Is this correct for a 16F88??

Warm regards, Howard

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8420
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2405 times
Been thanked: 3437 times
Contact:

Re: EEProm Initialize Help?

Postby medelec35 » Thu Mar 15, 2012 9:45 am

Glad I could help.
Collimare wrote:I have noticed a 3 second delay after write in most of the examples. Is this correct for a 16F88??


Is the delay with simulator or with your hardware?

I write to EEPROM with a project I completed, and I have not noticed any delay with the hardware.
I was writing to locations.

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 74
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 97 times
Been thanked: 15 times
Contact:

Re: EEProm Initialize Help?

Postby AbhijitR » Mon Oct 15, 2018 8:17 am

medelec35 wrote:Hi Howard,
What I do is use one additional address to store a key value e.g 22 when I write to EEPROM

Then if the chip is reset and I want to read my stored data from EEPROM:
I first read the key value, if its 22 then I read from the EEPROM location that contains my stored data.

If value = 22:
Yes then read EEPROM
no: //Don't bother reading since EEPROM has not been wrote to yet.

Hope this helps.

I have explained about a similar thing here:
http://www.matrixmultimedia.com/mmforum ... 950#p28950

If your still stuck I can assist you further.


Martin


Hello! Martin

Kindly excuse but honestly I did not understand the above explanation, my doubt is if I want to store 0 (zero) OR 28, as the initial value of the EEPROM, while loading the *.hex file in the hardware, do I only write 28 in the "Initial Values" in the properties window of the EEPROM and I will be able to read the same value (ie 28) later while running the program in the actual hardware, or there is some other method to do so.

I tried doing the above but I notice the value (ie 28) change to 255 after loading the *.hex file to the chip.

Can you shed some light on this.

Thank you.

Regards
Abhi

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8420
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2405 times
Been thanked: 3437 times
Contact:

Re: EEProm Initialize Help?

Postby medelec35 » Mon Oct 15, 2018 10:05 am

When sending hex to chip the programmer default setting is to erase all EEPROM values = 255
So if not wrote to EEPROM after programming chip then the value will be 255, that is expected.
Your program needs to write to EEPROM if the value read is 255.
After then when power is removed/restored then EEPROM will contain expected value.
These users thanked the author medelec35 for the post:
AbhijitR (Mon Oct 15, 2018 1:25 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 74
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 97 times
Been thanked: 15 times
Contact:

Re: EEProm Initialize Help?

Postby AbhijitR » Mon Oct 15, 2018 1:35 pm

Oh! Martin, you make it so simple to understand, but then the option to write the "Initial Value" in the EEPROM properties window is of no use, is it? And in the actual execution of the program in the hardware I can use the value till 254, did I got right.

Abhi

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8420
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2405 times
Been thanked: 3437 times
Contact:

Re: EEProm Initialize Help?

Postby medelec35 » Mon Oct 15, 2018 2:43 pm

In main, before the main loop just read the value of EEPROM.
If value = 255 then write new default value to EEPROM.
Then when power is restored next time the value won't be 255 so the new default value will not be written to EEPROM.
These users thanked the author medelec35 for the post:
AbhijitR (Mon Oct 15, 2018 7:47 pm)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: EEProm Initialize Help?

Postby Benj » Mon Oct 15, 2018 5:25 pm

It's been a long while since I looked at Flowcode 5 and I could be overlooking some problem but the initial values field should set the EEPROM values after programming.

Here is the programming sequence.

Delete EE Contents - all values set to 255
Program initial values - anything with an initial value is pre-programmed
Reset into First run - initial values should be available
These users thanked the author Benj for the post:
AbhijitR (Mon Oct 15, 2018 7:47 pm)
Rating: 5.26%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8420
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2405 times
Been thanked: 3437 times
Contact:

Re: EEProm Initialize Help?

Postby medelec35 » Mon Oct 15, 2018 8:43 pm

Benj wrote:but the initial values field should set the EEPROM values after programming.

I thought that was introduced with Flowcode V6? ?

@Abhi
As you have posted in the v7 section previously Are you stuck with that version?
These users thanked the author medelec35 for the post:
Benj (Tue Oct 16, 2018 9:58 am)
Rating: 5.26%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
AbhijitR
Posts: 74
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 97 times
Been thanked: 15 times
Contact:

Re: EEProm Initialize Help?

Postby AbhijitR » Tue Oct 16, 2018 4:21 am

medelec35 wrote:@Abhi
As you have posted in the v7 section previously Are you stuck with that version?


Hello! Martin

Kindly excuse me if I posted in the wrong section, it is really confusing for me, I thought I posted in the continuation of previous posts in version 5, :shock: , I am still using version 6 for the moment, but willing to buy version 8 :D

Abhi