3.1.2 Clock

Both the door and desk modules in this application require a high-frequency clock to run the RN4678 Bluetooth Click module at the required baud rate, and to meet the strict timing requirements of the NeoPixel LED Stick. Using the microcontrollers’s HFINTOSC clock at 16 MHz meets these requirements. All other clock settings use their default values. See Clock Initialization Code for the setup code for the clock.

Clock Initialization Code

    //SOSCPWR Low power; 
    OSCCON3 = 0x00;
    // HFOEN disabled; MFOEN disabled; LFOEN disabled;
    // SOSCEN disabled; ADOEN disabled; 
    OSCEN = 0x00;
    // HFFRQ 16_MHz; 
    OSCFRQ = 0x04;
    // TUN undefined; 
    OSCTUNE = 0x00;
    // ACTEN disabled; ACTUD enabled; ACTLOCK Not locked; ACTORS In range; 
    ACTCON = 0x00;