|
|
View previous topic :: View next topic |
Author |
Message |
arunkish
Joined: 23 Dec 2008 Posts: 83
|
18F2550 Program Memory |
Posted: Fri Aug 22, 2014 9:57 pm |
|
|
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: 19504
|
|
Posted: Fri Aug 22, 2014 11:12 pm |
|
|
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
|
|
Posted: Tue Aug 26, 2014 5:55 am |
|
|
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. |
|
|
|
|
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
|