• AVR Freaks

Helpful ReplyPic18f46k22 C18 can't turn on PLL

Author
ricardopereira
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2012/11/12 03:46:12
  • Location: 0
  • Status: offline
2012/11/30 02:58:17 (permalink)
0

Pic18f46k22 C18 can't turn on PLL

Hi there sorry to bring this again but i already readed alot posts about this and i'm thinking that my code is ok to put the pic at 64MHz but my oscilloscope is only reading 16Mhz at RA6 pin it seams that PLL is not turned on plz help.


#include <p18f46k22.h>
#include <delays.h>

#pragma config FOSC = INTIO7    // Oscillator Selection bits (Internal oscillator block, CLKOUT function on OSC2)

void main(void){
OSCCONbits.IRCF2=1;
OSCCONbits.IRCF1=1;
OSCCONbits.IRCF0=1;
OSCCONbits.SCS0=0;
OSCCONbits.SCS1=0;
OSCTUNEbits.PLLEN=1;

  TRISCbits.RC0=0;  // the rest is just to have some extra visual knowledge of frequency
    while(1) {
           LATCbits.LATC0 = ~LATCbits.LATC0; // toggle LATD
    Delay10KTCYx(250);
        Delay10KTCYx(250);
        Delay10KTCYx(250);
        Delay10KTCYx(250);
    }
}
 

 
Sorry about the bad english and plz help
#1
vloki
Jo, alla!
  • Total Posts : 6811
  • Reward points : 0
  • Joined: 2007/10/15 00:51:49
  • Location: Germany
  • Status: offline
Re:Pic18f46k22 C18 can't turn on PLL 2012/11/30 03:08:49 (permalink)
0
Not sure if the clock output is from behind PLL or before.
Change your code to

while(1) {
           LATCbits.LATC0 = ~LATCbits.LATC0; // toggle
         LATCbits.LATC0 = ~LATCbits.LATC0;
           LATCbits.LATC0 = ~LATCbits.LATC0;
          LATCbits.LATC0 = ~LATCbits.LATC0;
           LATCbits.LATC0 = ~LATCbits.LATC0;
...
}

Measure the frequency at PIN_C0.
If FOSC is 64MHz the instruction clock would be 16MHz
and at the scope you would get a freq of 8MHz because you need to toggles for one period.

Uffbasse !
#2
ricardopereira
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2012/11/12 03:46:12
  • Location: 0
  • Status: offline
Re:Pic18f46k22 C18 can't turn on PLL 2012/11/30 03:25:35 (permalink)
0
thanks for the time yet i'm reading a 125ns period that gives a 8Mhz frequency
so that means that i'm running at 64Mhz (16 x 4 pll) in pic but in RA6 clock output doesn't show the PLL multiplication right?
#3
vloki
Jo, alla!
  • Total Posts : 6811
  • Reward points : 0
  • Joined: 2007/10/15 00:51:49
  • Location: Germany
  • Status: offline
Re:Pic18f46k22 C18 can't turn on PLL 2012/11/30 03:33:41 (permalink) ☄ Helpful
+2 (1)
ricardopereira
... but in RA6 clock output doesn't show the PLL multiplication right?
I'd say yes, that's right ;-) 


Uffbasse !
#4
ricardopereira
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2012/11/12 03:46:12
  • Location: 0
  • Status: offline
Re:Pic18f46k22 C18 can't turn on PLL 2012/11/30 04:48:27 (permalink)
0
thanks for the time and knowhow
#5
Jump to:
© 2019 APG vNext Commercial Version 4.5