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

PIC24FJ256GA705 Clock & PLL confusion

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



Joined: 23 Jan 2018
Posts: 44

View user's profile Send private message

PIC24FJ256GA705 Clock & PLL confusion
PostPosted: Mon Sep 13, 2021 5:53 am     Reply with quote

Hi,

I am using PIC24FJ256GA705 in one of my project and my compiler version is 5.083. My crystal oscillator is 8Mhz and I want to use PLL with 4 times. What should be the correct fuses bit to use PLL4 or PLL4X?

Again, in
#use delay(clock=?)
what should I write in clock speed for above mention scenario 8MHz or 32MHz?

Thanks in advance.
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Mon Sep 13, 2021 7:43 am     Reply with quote

Just specify the crystal, and the final clock rate.
So:

#use delay(crystal=8MHz, clock=32MHz)

tells the compiler to set this up.
There are actually two different ways this can be programmed. The first
would need /2, followed by the *24 PLL, and then the default /3 divisor.
In fact it should use the alternative PLL 'route' for this, which simply
offers *4, *6 or *8.

Just setting the clock like this, provided you don't specify any clock fuses,
will automatically set these.
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Mon Sep 13, 2021 8:48 am     Reply with quote

A further comment...

Structure your program to set the fuses first, then specify the clock settings. If you reverse the order, you can inadvertently overwrite the proper clock fuses.
Mrinmoy Dey



Joined: 23 Jan 2018
Posts: 44

View user's profile Send private message

PostPosted: Mon Sep 13, 2021 11:14 pm     Reply with quote

@Ttelmah

Thank you sir.
So, all over what I understand is by setting crystal and clock in "#use delay" will automatically set the PLL; no need to set PLL fuse bits explicitly.
Mrinmoy Dey



Joined: 23 Jan 2018
Posts: 44

View user's profile Send private message

PostPosted: Mon Sep 13, 2021 11:15 pm     Reply with quote

@newguy

Yes, I set my all program exactly the same way you suggested.
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Tue Sep 14, 2021 6:03 am     Reply with quote

Yes,
On most of the other DsPIC's, it has to be done this way, because their PLL's
are setup in software after boot. Yours is one of the few where the PLL can
be set in fuses.
However the key with #use delay, is that there are quite a few 'extras',
beyond the basic clock rate setting abilities, So (for instance) you can also
program the USB clocks on some chips, and specify separately the actual
oscillator and final clock, which then makes it do the PLL settings (if it
can). If you specify a clock it can't actually achieve, it will give a warning.
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