View previous topic :: View next topic |
Author |
Message |
milk3422
Joined: 06 Feb 2008 Posts: 10
|
Flash memory erasing on power on/off |
Posted: Fri Feb 22, 2008 12:38 am |
|
|
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
|
|
Posted: Fri Feb 22, 2008 12:52 am |
|
|
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
|
|
Posted: Fri Feb 22, 2008 6:35 am |
|
|
Thank you, problem solved!
Now, I know I was sitting down looking at this for way to long! |
|
|
|