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

PIC16f870 writing data to internal flash

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



Joined: 22 Sep 2008
Posts: 6

View user's profile Send private message Yahoo Messenger MSN Messenger

PIC16f870 writing data to internal flash
PostPosted: Wed Dec 01, 2010 4:34 am     Reply with quote

Hi can anybody tell me how to write data to the internal flash of the PIC16F870.
any routine or tutorial in c.

Thanks
_________________
!!!!...HUSSAIN AFTAB...!!!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19401

View user's profile Send private message

PostPosted: Wed Dec 01, 2010 8:24 am     Reply with quote

Several distinctly different routes/parts to this:
1) if you declare a variable in your code as 'const', this is stored in the flash for you, and automatically read by the compiler when you read it. The easiest route.
2) If this is a value you want to change, then consider putting it into the data EEPROM instead. The 'write life' of the flash, is only 1000 cycles on this chip, against 100K cycles for the EEPROM. Look at the read_eeprom and write_eeprom functions, and the notes with these about transferring values larger than a byte.
3) If you really 'must' write to the flash, and understand the write limitations, then look at the read_program_memory, and write_program memory functions, the overview of these, and the notes about them. Also the bootloader example, which (of course), uses these.

Best Wishes
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