View previous topic :: View next topic |
Author |
Message |
bjerkely12
Joined: 04 May 2006 Posts: 5
|
pointer to EEPROM? |
Posted: Sun May 14, 2006 2:27 am |
|
|
Is it possible to declare a pointer to EEPROM ?
I want to read and write to EEPROM without using read_eeprom(),write_eeprom() routines.
Regards |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun May 14, 2006 9:33 am |
|
|
No. There is a sequence for reading and writing to the eeprom. These functions take care of that for you. Refer to datasheet to see what this sequence is. However, you can have a variable which represents an address and use this with the function. You can increment and decrement this variable like you would a pointer and then use the functions to access the data. A word of note, the compiler puts the function's code "inline" so if you have many calls to the functions, you will have much wasted space. A solution to this is to wrap those functions inside another function or read the datasheet and write your own. |
|
|
Ttelmah Guest
|
|
Posted: Mon May 15, 2006 3:20 am |
|
|
Well, actually you can!...
The key is the compiler option 'typemod'.
You declare a named memory 'region', that is the EEPROM, with the two I/O functions needed to access this, and then you can access this region with a pointer if required.
In all honesty, it is probably more complex, than just using an address to access the EEPROM, but the same trick can also be used on chips that can access the program memory, to allow pointers to data in this memory as well. There is a significant overhead associated with doing this, but the ability is there.
Best Wishes |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
|
|