I am quite confused about the relationship between the declared MCU Clock frequency ( which we set from edit project window) and the oscillator frequency (which we set by codding). So for an example let's say I need 31 kHz frequency. Do I also need to set the MCU Clock frequency from edit project window? If yes, in case of I want to change the frequency during the process, how am I supposed to change the clock frequency during run time?( Since I will not be able to change declared clock frequency.)
If you are using MPLAB X, the Harmony Plug-In will create code from your settings in UI. So it's the same and initial frequency on startup. If you want to change the frequency during runtime, you have to set the registers accordingly - but this sounds somehow odd.