| View previous topic :: View next topic |
| Author |
Message |
SeeCwriter
Joined: 18 Nov 2013 Posts: 179
|
| How to enable PLL |
Posted: Wed Dec 02, 2026 11:19 am |
|
|
I'm using an 18K67K22, and CCS compiler v5.125. I'm trying to enable the 4X PLL without success.
This is the beginning of my header file:
| Code: |
#FUSES PUT
#FUSES WDT_SW // Software Watch Dog Timer.
#FUSES WDT512 // Watch Dog Timer uses 1:512 Postscale for 2-sec timeout.
#FUSES BORV30 // Brown-out Reset at 3.0V.
#FUSES PLLEN
#use delay(internal=64MHz)
|
Also, the first function in main() is:
| Code: |
setup_oscillator( OSC_16MHZ | OSC_PLL_ON );
|
And yet the list file shows the PLL is disabled:
| Code: |
Word 1: C815 VREGSLEEP INTRC_HP SOSC_DIG NOXINST INTRC_IO NOPLLEN FCMEN IESO
|
What am I missing? |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20164
|
|
Posted: Wed Dec 02, 2026 1:38 pm |
|
|
Fiddle less......
Get rid of the clock fuses.
Get rid of the oscillator setup.
Just use the clock statement.
Your #use delay (internal=64MHz),
Will be enabling the PLL.
It is.
You need to read the data sheet. The point is that the PLL cannot
be turned on _in the fuses_ with the internal oscillator. It has to be setup
at the start of the main code. The delay code will automatically add this to
start of the main. If you use symbolic mode for the listing and look at the
.lst file, you will find that just a few lines in at the start of the main, the
compiler is merrily adding the lines to enable the PLL. |
|
 |
SeeCwriter
Joined: 18 Nov 2013 Posts: 179
|
|
Posted: Wed Dec 02, 2026 3:43 pm |
|
|
That worked. But now the RS232 port limited to 4800baud even though I configured it to 38400.
| Code: |
#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8);
|
I have to go back to NOPLLEN to get the desired baud rate. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20164
|
|
Posted: Thu Dec 03, 2026 1:32 am |
|
|
OK. That is the BRGH bit.
The point is with the high clock rate, the BRGH bit has to be set to allow
the multiplier to get to 38K4.
This is done in the #USE setup for the UART, by adding:
BRGH1OK
Be very careful. It is BRGH1, and 'OK', saying this can be enabled, not
the digits 10.
The problem is that quite a few PIC's in the early days had issues if you
tried to use the BRGH bit, so CCS made it that you have to tell the compiler
that it is OK to use this bit. |
|
 |
|