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

18F2550 Program Memory

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



Joined: 23 Dec 2008
Posts: 83

View user's profile Send private message

18F2550 Program Memory
PostPosted: Fri Aug 22, 2014 9:57 pm     Reply with quote

Hello All

I am using 18F2550, and I am trying to write to the ROM using write_program_eeprom() function, but it is not working. Will this PIC support this function or should I turn on/off some fuses? I have learned that in some PIC's a total of 32 or 64 bytes has to be written at a time. How can I do that? Please advise.

Thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Fri Aug 22, 2014 11:12 pm     Reply with quote

First thing, give your compiler version?.

The current versions do write correctly to this chip, but there is no guarantee that your version does, if it is old.

Then you need to understand, that a 'write', can only change bits from the erased state, to the other state. You can't set a bit to '1' with a write.

Now on this chip, erases can only be done 64bytes at a time. Writes can be done 32bytes at a time.

The write_program_memory function, will automatically perform an erase, if you write to the first byte of a page. The write_program_eeprom function, does not perform an erase. Most of the later chips do support single byte writes (which is why this function exists), but this one doesn't.

The sequence you need, is to read the whole of a 64byte block to the page boundary below the byte you want to change.
Then change the single byte you want in this table in RAM.
Then write the whole 64byte byte block back, with write_program_memory (which will automatically trigger an erase).
arunkish



Joined: 23 Dec 2008
Posts: 83

View user's profile Send private message

PostPosted: Tue Aug 26, 2014 5:55 am     Reply with quote

Sorry for the delayed reply. Thank you so much for your TIP. I am using a very old version of compiler 3.222.

Thanks a lot.
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