On a microchip PIC16 microcontroller I have a program of the sort:
off = 2;
period = 10;
while (1) {
if (counter == 1) {
switch something on;
}elseif (counter == off) {
switch something off;
}elseif (counter == period) {
counter = 1;
}
counter++;
pause;
}
In a communication module of my code (not shown) I would like to implement the possibility to modify the program code: to change the values assigned to "off" and "period".
Note: I do not want to make a variable assignment (which is lost on reset) but want to make a permanent change to the program stored on the device.
Can somebody point me in the right direction? Ideally I would like to implement this in C. What is the easiest way to do this? Should "off" and "period" be variables, pointers or constants for easy implementation?
Many thanks!