-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
13 lines (12 loc) · 1.23 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
#define SYS_FREQ (80000000ul) // Hz.
#define GetSystemClock() (SYS_FREQ) // Used instead of SYS_FREQ in some modules.
#define GetInstructionClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32. Might need changing if using Doze modes.
#define GetPeripheralClock() (GetSystemClock()/1) // Normally GetSystemClock()/4 for PIC18, GetSystemClock()/2 for PIC24/dsPIC, and GetSystemClock()/1 for PIC32. Divisor may be different if using a PIC32 since it's configurable.
#pragma config FPLLIDIV = DIV_2 // PLL Input Divider (2x Divider)
#pragma config FPLLMUL = MUL_20 // PLL Multiplier (20x Multiplier)
#pragma config FPLLODIV = DIV_1 // System PLL Output Clock Divider (PLL Divide by 1)
#pragma config FNOSC = PRIPLL // Oscillator Selection Bits (Primary Osc w/PLL (XT+,HS+,EC+PLL))
#pragma config POSCMOD = XT // Primary Oscillator Configuration (XT osc mode)
#pragma config FPBDIV = DIV_1 // Peripheral Clock Divisor (Pb_Clk is Sys_Clk/1)
#pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider (2x Divider) - For 8MHz crystal
#pragma config UPLLEN = ON // USB PLL Enable (Enabled)