1. The &f_wpm and &RegPointer are the same address.
2. What is the problem? Can't build? Won't read?
3. How about post the project here?
When you write typically you write a whole row at a time. One
way of handling various variable sizes is a structure. You know
the length of the sturcture in bytes from its definition, so when you
go to access for a read you use a pointer to EEPROM staret of structure,
and another to the start of structure in RAM. You read a byte at a time from
FLASH, write the byte to RAM structure via its pointer, then inc both pointers.
Also I think there is a little confusion over EEPROM vs FLASH. Your chip
has 256K of FLASH, not EEPROM. But you can use FLASH as emulated
EEPROM, although its lifetime for write/erase cycles substantially less
unless you use an aging algorithim which moves to a new section of
FLASH when you hit the R/W cycle limit in a particular area of FLASH.
Thanks for the responses. I will give it another go based on what I have read. Yes, it is not 256K EEPROM, it is 2K. My mistake.
The project does compile and run properly with the exception of the floats not working properly. Previously I had all the data required to persist through reboots stored in Emulated EEPROM. This I found much easier to manage as the APIs for Emulated EEPROM are easier to use and no knowledge of the underlying hardware is required. However, I decided to attempt to use EEPROM to free up just a bit more space in the flash memory and to use EEPROM for its intended purpose (to maintain data that needs to persist over reboots. As previously mentioned, the byte sized variables work fine. It is the floats that I am experiencing issue with.
I have attached the source file that contains the code used to manage the EEPROM variables.
iambic.c.zip 3.3 K
Examine the float in memory to see how its stored, then
code appropriately the translation back to RAM using pointer.
Eg. get the byte order synched.