News:

Let's find out together what makes a PIC Tick!

Main Menu

PLL_Setup query

Started by RGV250, Today at 05:47 PM

Previous topic - Next topic

RGV250

Hi,
I have been looking for information regards the PLL setup and the closest information I can find is this from the oscillator frequency declare in the manual.
I am trying to figure out what these figures actually equate to in the device datasheet and what the $0300 is for.
Also, if I wanted to tweak it with OSCTUN I assume that I would need to do that prior to PLL_Setup but cannot find that either.

QuoteExample 3
' PIC24H internal 7.37MHz oscillator operating at 79.23MHz using PLL
'
Device = 24HJ128GP502
Declare Xtal = 79.23
'-------------------------------------------------------------------
Main:
' Configure the Oscillator to operate the device at 79.23MHz
' Fosc = (7.37 * 43) / (2 * 2) = 79.23MHz (40 MIPS)
'
PLL_Setup(43, 2, 2, $0300)

Regards,
Bob

trastikata

Here's an example how I set up dsPIC33EP512MC806 using an Excel spreadsheet I've created.

The clock calculation formula has one small difference that adds few clocks, but you will have an idea how to setup the 24HJ128GP502 (it does not have the PLLDIV + 2).

dsPIC_CLOCK.zip

And here's the Positron code:

'Set Fosc   
Proc SetCrystal()
    Clear
    'FRC = 8 MHz --> PLLDIV = 68 for 140MHz / PLLDIV = 73 For 150MHz
    CLKDIV = %0000000000000000 'PLLPRE = 0 ; PLLPOST = 0
    PLLFBD.Byte0 = 73 '--> 150MHz Fp
    OSCCON = %0000000100000000
    OSCTUN = 23
    'Wait for oscillator PLL lock
    While OSCCON.5 = 0 : Wend
EndProc 

Clock.jpg