View previous topic :: View next topic |
Author |
Message |
jahan
Joined: 04 Apr 2005 Posts: 63
|
EEPROM problem with each Programming of 18F Microchip |
Posted: Mon Aug 04, 2008 10:18 am |
|
|
Using CCS, is there a way to preserve the data in EEPROM each time I program my 18F chip?
I cannot seem to find a flag to preserve the EEPROM on each programming cycle.
My problem is each time I re-program my chip, I lose all the EEPROM data on the chip from previous data collections.
I really don't want to download the code before each programming.
I would like to make small corrections to the code and upload the code only. |
|
|
Ttelmah Guest
|
|
Posted: Mon Aug 04, 2008 10:26 am |
|
|
Nothing to do with CCS C. This is down to your programmer...
Some have an option to not perform a full erase unless necessary. If you select this, and don't include any EEPROM data in the code, then the EEPROM will be saved. Otherwise you will need to read the EEPROM, into a data file, and write it back after the code is loaded.
Best Wishes |
|
|
jahan
Joined: 04 Apr 2005 Posts: 63
|
|
Posted: Mon Aug 04, 2008 11:31 am |
|
|
Ttelmah:
In my code, I'm actually not writing to EEPROM during initial programming process.
The actual program once executed will store information in EEPROM.
Each time I run the program, during the initialization, the system reads 0x1 to see if it should be running or not.
If I read location 0x1 thru my LCD, it shows 1 (running).
It has been set using a button to turn the system ON and saved the value in location 0x1 of EEPROM.
If I reprogram the microchip, the LCD shows value 255 at location 0x1 (not 0x1) which was set before reprogramming the chip. |
|
|
Ttelmah Guest
|
|
Posted: Mon Aug 04, 2008 11:35 am |
|
|
Nothing to do with CCS C. This is down to your programmer...
Some have an option to not perform a full erase unless necessary. If you select this, and don't include any EEPROM data in the code, then the EEPROM will be saved. Otherwise you will need to read the EEPROM, into a data file, and write it back after the code is loaded.
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah Guest
|
|
Posted: Mon Aug 04, 2008 11:38 am |
|
|
Sorry about the double post, the system hung for a long while, then came up with invalid confirmation code, but had accepted the post...
255, is the value you get from an _erased_ location. Hence my comment still applies. Your programmer is erasing the chip (some allow you to select not to do this). It is not CCS C doing this, but your programmer.
Best Wishes |
|
|
|