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

Avoiding Overwriting Program in Program Memory

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



Joined: 23 Jul 2012
Posts: 14

View user's profile Send private message

Avoiding Overwriting Program in Program Memory
PostPosted: Mon Jul 23, 2012 6:54 pm     Reply with quote

Hi, I'm working with the PIC16LF1503 and need to store an I2C slave address (just one or two bytes) in non-volatile memory, so that it isn't lost when the PIC powers down. Since this chip doesn't have EEPROM, and a chip with EEPROM would be more expensive, I'm thinking about storing the data in the program memory.

However, my concern is that I might overwrite the program itself, leading to disastrous consequences. How do I know what spaces are "free" in the program memory? Is the program stored in one continuous length starting from address 0, therefore allowing me to store stuff at the back end of program memory (my program isn't large and I should have plenty of room)?

I'm using PCWHD version 4.133, and this will be implemented on real hardware, on the off chance that that helps.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 23, 2012 7:38 pm     Reply with quote

You can reserve flash memory for your own use with the #org statement:
http://www.ccsinfo.com/forum/viewtopic.php?t=21818

Look at the .LST file to see where the compiler puts the program and
other data. You can also look at the Program Memory window in the
View menu in MPLAB. For the 16F1503, you can use the end of Flash
memory for your own data. But use the #org statement to reserve it.
Seaborgium



Joined: 23 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Tue Jul 24, 2012 11:47 am     Reply with quote

Oh, I see. Thank you very much!
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