Active Clock Tuning Initialization

The ACT module is enabled by writing to the ACTCON register. If the user requires any changes to the SOSC or PMD modules, those changes need to be made in their respective registers. The ACT can be enabled by setting the ACTEN bit in the ACTCON register. Once enabled, the ACT takes control of the OSCTUNE register. The OSCTUNE register is automatically adjusted every reference clock cycle. The code below demonstrates the basic setup and configuration of Active Clock Tuning.

…
// Set SOSC to high-power mode, Application/Crystal dependent
OSCCON3bits.SOSCPWR = 1; 

// PMD (ACTMD) module enable, Not a requirement
PMD0bits.ACTMD = 0; 

// Enable ACT
ACTCONbits.ACTEN = 1;
…