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

Oscillator and PLL stuff - (SOLVED)

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



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

Oscillator and PLL stuff - (SOLVED)
PostPosted: Tue Apr 14, 2015 9:12 pm     Reply with quote

Nevermind - i figured it out... sorry for this... new PIC's have too many options.


Hi Guys, its been a while.

I can't figure out what bit I'm missing to get this thing to run at 48MHz.
I've been looking a the datasheet, and oscillator diagrams and concluded my problem is that although the PLL is enabled and the right prescaler is selected the PLL is being bypassed and I'm just running at 16MHZ as confirmed by O-Scope.

I suspect the problem to be the switch shown on Page 36 of the datasheet controlled by PLLEN and CFGPLLEN.... since I'm getting exactly 48/3=16Mhz or in other words, the raw oscillator frequency

Code:

   #include <18F47J53.h>

   #fuses NOWDT,NODSWDT
   #fuses NOXINST
   #fuses NODEBUG
   #fuses NOPROTECT

   #fuses HSPLL,PLLEN,NOIESO
   #fuses PLL4       //set usb pll clock to 4MHz (from 16Mhz input)
   #fuses NOCPUDIV   //set cpu clock to 48MHz
   #use delay(clock=48MHz)

#byte OSCTUNE = 0XF9B

void main()
{
   
   setup_oscillator(OSC_PLL_ON);    <--------- This was wrong.
   delay_ms(50);
   while(1)
   {
      output_high(PIN_C2);
      delay_ms(10);
      output_low(PIN_C2);
      delay_ms(10);
      
   }
}



LST File:


Configuration Fuses:
Word 1: F708 NOWDT PLL4 PLLEN NOSTVREN NOXINST DEBUG NOCPUDIV NOPROTECT
Word 2: FF75 HSPLL SOSC_DIG CLOCKOUT FCMEN NOIESO WDT32768
Word 3: FBF7 DSWDTOSC_INT RTCOSC_T1 DSBOR NODSWDT DSWDT2147483648 IOL1WAY ADC10 MSSPMSK7
Word 4: FBFF WPFP NOWPCFG WPDIS WPEND LS48MHZ


Thanks!

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
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