clock.c
Go to the documentation of this file.
1 
2 /*
3  * File: clock.c
4  * Author: Chris Hajduk
5  *
6  * Created on September 8, 2015, 11:16 PM
7  */
8 #include "../AttitudeManager/main.h"
9 #include "clock.h"
10 
12  // Configure PLL prescaler, PLL postscaler, PLL divisor
13  PLLFBD = 41; // M = 43
14  CLKDIVbits.PLLPOST=0; // N2 = 2
15  CLKDIVbits.PLLPRE=0; // N1 = 2
16  // Initiate Clock Switch to Internal FRC with PLL (NOSC = 0b001)
17  __builtin_write_OSCCONH(0x01);
18  __builtin_write_OSCCONL(0x01);
19  // Wait for Clock switch to occur
20  while (OSCCONbits.COSC != 0b001);
21  // Wait for PLL to lock
22  while(OSCCONbits.LOCK != 1) {};
23 }
void useFRCPLLClock()
Definition: clock.c:11