Searching \ for '[PIC] PLL with internal clock not working...' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/math/filter.htm?key=pll
Search entire site for: 'PLL with internal clock not working...'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] PLL with internal clock not working...'
2009\02\15@233022 by solarwind

picon face
Hey all.

I read the datasheet and tried my best to configure PLL to work with
my internal clock source. I am using a PIC 18 F 2620 with internal RC
enabled at 8 MHz. I am trying to enable PLL with a 4x multiplier to
get a 32 MHz clock. Here is how I have my code configured:

void main() {
       OSCCON = 0b01110010; //8 MHz
       OSCTUNE = 0b01011111; //PLL is enabled, maximum frequency

... ... ...


However, when I test my code (in real life, not simulator), the PLL
doesn't seem to be working. My hard-coded 1 second delays are running
at one second and not 1/4 seconds.

Any ideas why?

--
solarwind

2009\02\15@233233 by solarwind

picon face
Also, the datasheet says that two conditions need to be met:

1. Needs to be running at either 4 or 8 MHz on internal clock. --- Got it.
2. Internal clock needs to be set as primary clock source. --- Does
this mean setting the configuration words?

If so, my configuration is set like this:

#pragma config OSC = INTIO67  //Internal oscillator
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = ON
#pragma config BOREN = OFF
#pragma config WDT = OFF
#pragma config MCLRE = OFF
#pragma config PBADEN = OFF
#pragma config LVP = OFF

2009\02\15@234250 by solarwind

picon face
Nevermind, figured it out.

OSCCON should be:

OSCCON = 0b01110000;

as

bit 1-0 SCS1:SCS0: System Clock Select bits
1x = Internal oscillator block
01 = Secondary (Timer1) oscillator
00 = Primary oscillator

Thanks anyway! Works great now!

2009\02\16@000042 by solarwind

picon face
Blogging is fun -
solar-blogg.blogspot.com/2009/02/turbocharge-your-pic-with-pll.html

2009\02\16@074955 by olin piclist

face picon face
solarwind wrote:
> I read the datasheet and tried my best to configure PLL to work with
> my internal clock source. I am using a PIC 18 F 2620 with internal RC
> enabled at 8 MHz. I am trying to enable PLL with a 4x multiplier to
> get a 32 MHz clock. Here is how I have my code configured:
>
> void main() {
> OSCCON = 0b01110010; //8 MHz

It's OK to load a complete bit mask into a register, but then you should
comment each bit.  For example:

userzap = 0b00111100;
//          XX------  not used
//          --111---  select highest voltage
//          -----1--  zap user on stack overflow
//          ------0-  disable automatic zap shutoff
//          -------0  select positive 1KV, not negative

> OSCTUNE = 0b01011111; //PLL is enabled, maximum frequency

I would leave the oscillator at its center frequency, especially until you
are sure everything else is working.

The thing I don't see here is the oscillator selection in the config bits.
This has to be the internal RC and it has to be set as primary.

> However, when I test my code (in real life, not simulator), the PLL
> doesn't seem to be working. My hard-coded 1 second delays are running
> at one second and not 1/4 seconds.

Maybe your idea of 1 second is wrong in the code.  Have the PIC run a simple
loop like:

loop
    btg    portb, 0
    jump   loop

That will toggle the pin every 3 instructions, so the frequency will be the
instruction clock / 6.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2009\02\16@140436 by solarwind

picon face
On Mon, Feb 16, 2009 at 7:49 AM, Olin Lathrop <spam_OUTolin_piclistTakeThisOuTspamembedinc.com> wrote:
{Quote hidden}

It was my mistake, Olin. The last two bits of OSCCON need to be 0 0 to
set the internal RC as primary oscillator. Everything works now as
expected. Thanks!

I posted 4 replies in total above you. You didn't receive them? All in
the same hour.

--
solarwind

2009\02\17@084728 by M Wedin

picon face
Please do go ahead and blog, but not on a mailing list!



2009/2/16 solarwind <.....x.solarwind.xKILLspamspam@spam@gmail.com>:
{Quote hidden}

> -

2009\02\17@184358 by M Wedin

picon face
Quite off topic, sorry.


>>>
>>> I posted 4 replies in total above you. You didn't receive them? All in
>>> the same hour.
>>>

This is NOT an accomplishment.

>> I'm a PIC user, not from hell, nor the patronising kind.

>I'm atheist too, down with religion!

I am agnostic ...

>> Advice: When you feel like asking a question, hold off for an hour, or
>> over night. That would have helped a lot in this particular thread.
>> Don't you agree? Valid questions are welcomed. Silly noise, is not.
>>
>> Wed

>I don't need your bloody advice.

While this is true, you are not doing very well without them.
http://catb.org/~esr/faqs/smart-questions.html

>Refrain from contacting this email in the future.

Going public isn't a much better. But I respect your wish.

2009\02\17@185530 by Bob Blick

face
flavicon
face
That's right, off topic STOP NOW.

-Bob

M Wedin wrote:
> Quite off topic, sorry.

More... (looser matching)
- Last day of these posts
- In 2009 , 2010 only
- Today
- New search...