CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

[Solved] Internal Eeprom data retention

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
padbol



Joined: 25 Apr 2011
Posts: 11
Location: Belgium

View user's profile Send private message

[Solved] Internal Eeprom data retention
PostPosted: Thu May 31, 2012 3:13 am     Reply with quote

Hello,

I'm experiencing a disturbing issue using the internal eeprom of a 18F4550 PIC.

First I writed a value that I read before displaying it. And it works.
Code:

float MaxTemp;
WriteEeprom_Float(0x04,29.5);
MaxTemp = ReadEeprom_Float(0x04);
printf("\fTemp %2.1f",MaxTemp);
while(1);


Secondly, I remove the writing sentence to read the previous value again which doesn't work.
Code:

float MaxTemp;
//WriteEeprom_Float(0x04,29.5);
MaxTemp = ReadEeprom_Float(0x04);
printf("\fTemp %2.1f",MaxTemp);
while(1);


(*) Read/Write Eeprom_Float(...) is written like this : http://www.ccsinfo.com/faq.php?page=write_eeprom_not_byte

Read value seems to be empty after powering down the device.

Is there any operation to do telling the microcontroler to retain datas written into its eeprom? Or something else? Does someone can tell me where am I wrong?

It's driving me crazy.

I really thank you for your help Smile
_________________
- Be the change you want to see in the world (Gandhi) -


Last edited by padbol on Thu May 31, 2012 3:39 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Thu May 31, 2012 3:20 am     Reply with quote

Surely, the key is that you are not just 'powering down the device', but reprogramming it to write the new code.
There should be an option in whatever programmer you are using to not erase the EEPROM. Otherwise it'll be cleared when you write the code.

Best Wishes
padbol



Joined: 25 Apr 2011
Posts: 11
Location: Belgium

View user's profile Send private message

PostPosted: Thu May 31, 2012 3:29 am     Reply with quote

Ttelmah wrote:
Surely, the key is that you are not just 'powering down the device', but reprogramming it to write the new code.
There should be an option in whatever programmer you are using to not erase the EEPROM. Otherwise it'll be cleared when you write the code.

Best Wishes


Idea Great! Thank you! That's right Smile

I changed it here : Programmer / Settings / Program memory tab : "Preserve eeprom on program"
_________________
- Be the change you want to see in the world (Gandhi) -
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group