CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to enable PLL

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
SeeCwriter



Joined: 18 Nov 2013
Posts: 179

View user's profile Send private message

How to enable PLL
PostPosted: Wed Dec 02, 2026 11:19 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 02, 2026 1:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 02, 2026 3:43 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 03, 2026 1:32 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group