Hello, and welcome to the forum.
The programming of non-volatile parameters from within the user code is not really practical for MC9RS08 devices. To do so would require the switching of an external programming voltage.
A portion of the programming code then needs to be run from RAM. This code is relatively complex, and must generate critical timing intervals. The incorrect timing may permanently damage the flash memory. In addition, the programming of non-volatile parameters could be done only once because the only erase process available is a mass erase (which would also erase your code).
To do what you require, the use of a suitable MC9S08 device would be a far better choice.
- The programming voltage is internally generated.
- Some RAM based code is still required, but this is somewhat simpler, and does not require the generation of critical timing intervals.
- A page erase process is available, allowing the non-volatile parameters to be changed.
Regards,
Mac