Using a timing crystal October 03, 2012 07:29PM |
Registered: 11 years ago Posts: 7 |
Re: Using a timing crystal October 03, 2012 07:47PM |
Admin Registered: 11 years ago Posts: 351 |
#if defined ( USE_EXT_XTAL ) # pragma config FNOSC = PRIPLL // Oscillator Selection: Primary oscillator (XT, HS, EC) w/ PL # pragma config POSCMOD = HS // Primary Oscillator: HS oscillator #else # pragma config FNOSC = FRCPLL // Oscillator Selection # pragma config POSCMOD = OFF //HS //EC // Primary Oscillator #endif//defined ( USE_EXT_XTAL ) //#pragma config PMDL1WAY = OFF // multiple configurarion //#pragma config IOL1WAT = OFF //#pragma config FUSBIDIO = OFF //#pragma config FVBUSONIO = OFF #pragma config FPLLIDIV = DIV_2 // PLL Input Divider: Divide by 2 #pragma config FPLLMUL = MUL_20 // PLL Multiplier: Multiply by 20 #pragma config FPLLODIV = DIV_2 // PLL Output Divider: Divide by 2 #pragma config FSOSCEN = OFF // Secondary Oscillator Enable: Disabled #pragma config IESO = OFF // Internal/External Switch-over: Disabled #pragma config OSCIOFNC = OFF // CLKO Enable: Disabled #pragma config FCKSM = CSECMD//CSDCMD // Clock Switching & Fail Safe Monitor: Clock Switching Disabled, Clock Monitoring Disabled #pragma config FPBDIV = DIV_2 // Peripheral Clock divisor: Divide by #pragma config FWDTEN = OFF // Watchdog Timer: Disabled (SWDTEN Bit Controls) #pragma config WDTPS = PS16384 // Watchdog Timer Postscale: 16384:1 #pragma config CP = ON // Code Protect: #pragma config BWP = ON // Boot Flash Write Protect: #pragma config PWP = OFF // Program Flash Write Protect: #pragma config ICESEL = ICS_PGx2 // ICE/ICD Comm Channel Select: ICE pins shared with PGC1,PGD1 #pragma config DEBUG = OFF // Background Debugger Enable: OFF #pragma config JTAGEN = OFFThese configuraton values can be changed at run time but some of them require an unlock procedure, this is described in the Microchip guide, probably DS61112. There is just a chance that it is not possible to switch FNOSC at run time but I think it probably is.
Re: Using a timing crystal October 03, 2012 10:24PM |
Registered: 11 years ago Posts: 7 |
Re: Using a timing crystal October 04, 2012 08:06AM |
Admin Registered: 11 years ago Posts: 351 |