CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

pointer to EEPROM?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bjerkely12



Joined: 04 May 2006
Posts: 5

View user's profile Send private message

pointer to EEPROM?
PostPosted: Sun May 14, 2006 2:27 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Sun May 14, 2006 9:33 am     Reply with quote

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







PostPosted: Mon May 15, 2006 3:20 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Mon May 15, 2006 8:13 am     Reply with quote

Typemod URL

http://www.ccsinfo.com/faq.php?page=addressmod
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group