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 CCS Technical Support

Flash memory erasing on power on/off

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



Joined: 06 Feb 2008
Posts: 10

View user's profile Send private message AIM Address

Flash memory erasing on power on/off
PostPosted: Fri Feb 22, 2008 12:38 am     Reply with quote

I am compiling and running the example code ex_intfl.c to try and figure out how to use the flash memory on the 18f452.

The code compiles fine and I can run it. I can even select and change the values at memory locations.

My issue is, when I power off my circuit and power it back on all the changes I made to the flash memory have been deleted and all the memory address are reset to 0xFFF!

Maybe I am not understanding the concept of flash memory here.

What I need is to store some data(int, float, char, etc.) in memory that is non volatile. While I read through the 18F452 manual it said the the data EEPROM needs to be refreshed frequently, seeing as how the data I am storing may not change value frequently, I figured flash is where i should be storing data.

What I understand:
-Flash memory is where the actual program that is running on the PIC is being held. Flash is non-volatile.
-Data memory is ram which is used for local variables.
-Data EEPROM is also non-volatile memory that requires frequent refreshes.

Any help would be greatly appreciated. I would really love to know why the information getting written to flash memory is getting deleted.

Thank you!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 22, 2008 12:52 am     Reply with quote

Quote:
I am compiling and running the example code ex_intfl.c to try and figure
out how to use the flash memory on the 18f452.

My issue is, when I power off my circuit and power it back on all the
changes I made to the flash memory have been deleted

Look near the start of main() in the Ex_intfl.c file. It calls this function:
Code:
erase_program_eeprom(start_addr);   

It's erasing the flash memory.
milk3422



Joined: 06 Feb 2008
Posts: 10

View user's profile Send private message AIM Address

PostPosted: Fri Feb 22, 2008 6:35 am     Reply with quote

Thank you, problem solved!

Now, I know I was sitting down looking at this for way to long!
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