Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#config for 4 mhz

Randy
2013-12-22
2013-12-25
  • Randy
    Randy
    2013-12-22

    Hi, I'm trying to configure my 18F4550 with external 4 mhz oscillator to run at 48 mhz for CPU and USB

    The best I can figure is to use something like this;
    #config FOSC = ECPLL_EC, PLLDIV = 1, CPUDIV = OSC1_PLL2, USBDIV = 2

    Does this look correct? I'm choosing External Clock PLL for CPU and External Clock for USB and running
    the PLL off the external 4 mhz and the CPU and USB off the PLL divided by 2...

     
    Last edit: Anobium 2013-12-22
    • USBDIV can't be a 2 its 1 or 0.
      And assuming you want the RA6 pin to be an I/O pin then I believe this will give you the setup you want.
      Also, I assume you are using a 48 Mhz clock oscillator since you can't use a crystal for this.

       LIST p=18F4550, r=DEC
      #include <P18F4550.inc>
       CONFIG LVP = OFF, MCLRE = OFF, WDT = OFF, FCMEN = OFF, FOSC = ECPLLIO_EC, USBDIV = 1, CPUDIV = OSC1_PLL2, PLLDIV = 1
      
       
  • Anobium
    Anobium
    2013-12-22

    I am not expert on your chip. I just edited your record to sort the layout out. :-)

    This is what what I use for 16f chips.
    #chip 16F88,4

    So, using the logic you should simply use.
    #chip 18F4550,4

     
  • Randy
    Randy
    2013-12-25

    Thanks Chuck! Your right /1 or /2 is chosen by 0 or 1 so USBDIV = 0 and I just figured out
    the I/O on RA6 too. I'm using a 4 mhz external oscillator the PLL bumps it up to 48 mhz. I was scrambling around to buy a 48 mhz one until I found out I could use the 4 mhz one.

    Anobuim Thanks for the info but I set my program to #chip 18F4550, 48 as the external clock is 4 mhz but gets upconverted to 48 mhz by the PLL. It's all a bit confusing hence the call for help...