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 CCS Technical Support

how to write data onto program memory

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



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

how to write data onto program memory
PostPosted: Mon Jul 19, 2010 9:32 am     Reply with quote

Hi,
I am using PIC16F876A for my project.
I want to write a value into program memory at compile time, then at run time I want to read that value and modify it and then again write it and so on.

Can anybody provide me with a small example to that I can implement the same.

Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 9:45 am     Reply with quote

Use the forum search. This has been answered many times....

Be aware of the limitations:
1) When writing program memory, program execution stops.
2) The limited write life of the program memory.

http://www.ccsinfo.com/forum/viewtopic.php?t=38267
http://www.ccsinfo.com/forum/viewtopic.php?t=39402

For a couple of examples.
As a very sophisticated way of doing this, you can use Addressmod, but with a cost of code bulk.
If your chip has EEPROM, use this instead....

Best Wishes
bharatwalia



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 10:53 am     Reply with quote

Is it possible to write data onto eeprom at compile time?
And then retrieve it during program execution.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 11:23 am     Reply with quote

Yes.
For code examples use the search function of this forum. Hint, search for '0x2100' (the EEPROM address in a PIC16).
bharatwalia



Joined: 04 May 2009
Posts: 35
Location: India

View user's profile Send private message

PostPosted: Mon Jul 19, 2010 12:56 pm     Reply with quote

Thanks!... Very Happy

I got it working .... Laughing
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