PIC12F1501 writing & reading flash memory
Dear all,
I couldnt find my first post on the same topic in the forum and therefore, I am posting this again.
For my project, using PIC12F1501, I am using NCO peripheral to pulse my circuit and I will be operating it at 2 modes of operation, namely, Calibration mode & Normal operation mode. The underlying circuit operates best at a particular frequency and to find out that particular frequency, I need to have a frequency sweep once in lifetime, store that frequency value in flash and every other time, it operates in normal operation where it fetches the operating frequency from the flash. The switch between calibration and normal operation mode is done by a Digital input.
Calibration mode:
- Sweep the NCO frequency from 800kHz to 999kHz at a duty cycle of about 50% using PFM mode
- Find the best operating point (using AN pins)
- Store values in Flash.
Normal operation:
- Read the values from flash
- Initialize NCO frequency values with the read variables
- Do other functions.