COMPILER: XC8 v 1.30
micro: PIC18F46K20
I use this in CONFIG1H register to get 64MHz Fosc (and use PLL):
#pragma config FOSC = INTIO7 // 1001 = Internal oscillator block, CLKOUT
// function on RA6, port function on RA7
OSCON.IDLEN = 1; // 16 MHz (HFINTOSC drives clock directly)
OSCON.IRCF = 111;
OSCON.SCS = 00; // Primary clock (determined by CONFIG1H[FOSC<3:0>]).
OSCTUNE.PLLEN = 1; // enable PLL for 8 and 16MHz Fosc
And then uC runs at 64MHz and I get 64/4=16MHz signal on pin RA6 (as expected)
But when I tried 'HSPLL' – as in data sheet :
#pragma config FOSC = HSPLL // 0110 = HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
then it completely STALLS uC : !!! It would not even start after build and power up.
Any ideas ?
Best Answer
Page 31 of the datasheet has a section called "2.4.3 LP, XT, HS MODES". It has a diagram which shows the necessary external circuitry. By using HSPLL you are then using the HS mode with the PLL.
Page 27 has the following diagram, which I think is more helpful generally:
Then you know to what the macros are referring.