I'm writing a routine that changes the PIC32 clock speed on the fly by writing to OSCCONbits.PLLODIV. The core of it is:
// calculate PLLODIV value, then,
SYS_DEVCON_SystemUnlock();
OSCCONbits.PLLODIV = pllodiv;
SYS_DEVCON_Syst..