Yes that code is going to kill the EEPROM location quickly.
You need to write only every “so many” loops.
You could try turning brownout detect on, to ensure you have enough current because EEPROM writing is the most power hungry thing the pic can do,
and if you’re on the edge, that’s when it will fail.
and also check the EECON1 register after the write to verify the self timing worked, and the write actually completed (if not, try again).




Bookmarks