View previous topic :: View next topic |
Author |
Message |
Seth Guest
|
Write Program EEPROM issue |
Posted: Wed May 24, 2006 2:22 pm |
|
|
I am writing an eeprom slot in the program memory, specifically address 0x02610. After writing the eeprom the first time, I read it back and verify that the slot was correctly written. The second time I write to the slot and attempt to read it back, however, the wrong value is returned. Is there something I am doing wrong?
It's a pic18f2620
code snippet is pretty simple:
#define AIR_CALIB_BYTE_ADDR1 0x02610
//write :
write_program_eeprom(AIR_CALIB_BYTE_ADDR1,airPressureMultiplierEEPROM);
//read:
valueReadBack = read_program_eeprom(AIR_CALIB_BYTE_ADDR1); |
|
|
Ttelmah Guest
|
|
Posted: Wed May 24, 2006 2:36 pm |
|
|
Read the manual....
The write_program_eeprom function, _does not erase_. If you are writing a second time, you need to erase the block first.
Best Wishes |
|
|
Seth Guest
|
|
Posted: Wed May 24, 2006 2:48 pm |
|
|
I seem to recall reading somewhere on this site that the function write_program_eeprom performs the erase as part of its functionality. I guess I am wrong on that assumption.
I've figured out a work around. |
|
|
Ttelmah Guest
|
|
Posted: Wed May 24, 2006 2:55 pm |
|
|
Write_program_memory, does erase (but remember a whole block has to be erased). Write_program_eeprom doesn't. Look in the manual under 'write_program_memory', which explains the differences.
Best Wishes |
|
|
|