Is there a better way to store calibration values?
Posted: Mon Feb 09, 2026 9:25 am
<16F15223.H> CCS compiler 5.121
I use the following code to read and write calibration values to the memory of my PIC's for years. Although it works fine can somebody tell me if a better solution is available for the modern pic's like the 16F15223?
Sorry for this question but I'm a hardware engineer.......
newguy
Joined: 24 Jun 2004 Posts: 1928
Posted: Mon Feb 09, 2026 5:56 pm
Not really. Two things: the address of the high endurance flash should be available using the getenv feature so that you don't have to look it up yourself. Second, I always guard writes to memories that are either slow or can wear out (or both). I always read the contents of the memory first and only write if the value is different than what I intend to write.
Other than those minor nit picks, you're doing it right.
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