Electronic – Can the microcontroller program flash memory be used for storing user configuration

flashmicrocontrollerpic

Many microcontrollers, e.g. PIC18F, have flash program memory: "The Flash program memory is readable and writable during normal operation". Does this mean I can store some user configurations in the program memory?

Best Answer

Yes, you can. I have done this many times.

However, there are some drawbacks relative to using separate EEPROM:

  1. The number of lifetime writes to program flash memory is significantly less than data EEPROM.

  2. The processor will go out to lunch during the erase and write times.

  3. Program flash is erased in blocks. You can't just update a single byte. I usually use a block caching scheme to deal with this.