CLKSET(NewCLKMODE, NewCLKFREQ) syntax question
Safely establish new clock settings, updates CLKMODE and CLKFREQ
CLKMODE- The current clock mode, located at LONG[$40]. Initialized with the 'clkmode_' value.
CLKFREQ- The current clock frequency, located at LONG[$44]. Initialized with the 'clkfreq_' value.
For Spin2 methods, these variables can be read and written as 'clkmode' and 'clkfreq'. Rather than write these variables directly, it's much safer to use: CLKSET(new_clkmode, new_clkfreq)
This way, all other code sees a quick, parallel update to both 'clkmode' and 'clkfreq', and the clock mode transition is done safely, employing the prior values, in order to avoid a potential clock glitch.
Where do you find the CLKMODE\CLKFEQ settings. I think from the above (CLKSET)the compiler actually will generate the code to switch over. Normally I would assume the fastest rate would be the best but there may be some use to switch to a slower speed (RCFAST\RCSLOW) . Just want to include in notes for completness.
Regards and Thanks