Store data in built-in Flash of PIC at runtime using C code
With the processor you are using this should be as simple as eeprom_write(unsigned int address,unsigned char data), in which you can find the address of the eeprom/flash in the datasheets. Some processors don't seem to support this command though. If you look in the header file of the uC as well as the compiler header (eg. pic18.h) you can see whether certain commands have been commented out due to no definition being previously defined. If no definition, you will have to do it bit-wise and make sure that you do not cross with any vital program memory during run time.