External crystal for PIC18F13k50

Discussion in 'Embedded Systems and Microcontrollers' started by shteii01, Jul 20, 2014.

  1. shteii01

    Thread Starter AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    I am doing a bit of research.

    I am looking at PIC18F13k50. I saw that it can use 48 MHz external oscillator. So I decided to look into it. Looking into datasheet, it got a couple of nice pictures, no numbers, Figure 2-2. Found table in the end of the datasheet, Table 27-1. Table shows that 48 MHz is only doable with external clock module. The highest I am seeing for external crystal is 20 MHz.

    Did I get this right? 20 MHz is the fastest crystal I can use?

    Also. How do I figure out the capacitors for the crystal? Note 1 after Figure 2-2 lists 4 articles, I looked through first one and I did not see what I needed.

    Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/41350E.pdf
     
  2. shteii01

    Thread Starter AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    Hm... Maybe I found it. Table 27.4, Parameter Number D101*, 15 pF. Did I find the right thing?
     
  3. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    it has a 4x PLL you need 12 MHZ crystal
     
  4. shteii01

    Thread Starter AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    Yes, you are right, but for a different reason. I finally got to the part of datasheet that deals with USB. That part clearly says to get either 6 MHz or 12 MHz crystal, and for setup I am thinking about they say to get 12 MHz. So this part is now crystal clear to me.

    Can you advise me on the capacitors for the crystal. I was looking through digi key and they list load capacitor needed for specific crystal they sell. So I guess that is where I learn what capacitors to use, is that right? I don't actually need to figure out the capacitors. I simply choose the crystal to buy and then look at that crystal's datasheet to see what capacitors I need. Right?
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,370
    I have never found capacitance value to be super critical.
    15-22pF always seem to work.
     
  6. shteii01

    Thread Starter AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    That's the thing. I have never setup a uC from scratch. The one class I had on uC we used a development board that had the buttons, the lcd and led. All we, the students, had to do is write the program in C and upload it to the chip.
     
  7. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Buy a bag of 100 ceramic 15pF caps, and that will do you for years. Or 22pF.

    Then for every project it's just a xtal of your choosing and two caps.

    I keep an eye open for xtals in surplus quantities too, 8MHz 10MHz and 12MHz.

    3-pin resonators are great because they do the whole lot in one device, and can be bought cheap. But they are only accurate to about 0.5% freq so are no good for proper timekeeping applications, but are fine for simple timed periods etc.
     
  8. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    I tried a 6mhz resonator and it took me hours of time trying until i changed to 12mhz crystal osc and then it suddenly worked.
     
  9. shakilabanu

    Member

    Jul 8, 2014
    44
    2
    That is the case everywhere and with things like Arduino coming up...people dont even have to bother about them any more...even out of class work... regrettable but what can one do about it.
     
  10. shakilabanu

    Member

    Jul 8, 2014
    44
    2
    In my experience with PICs...these days I first look at the errata and then decide I want to use a particular controller... In the past I have had situations where I chose a controller for a specific reason, only to find later that that they forgot to put the feature in...when they manufactured the IC !!!

    If you are working with new controllers do check out the errata too.
     
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    I have never personally has issues using a crystal on a PIC. I shoot for 22pF but if I only have something smaller then I go and use that.

    I have never personally has issues using a resonator on a PIC. I shoot for one with a 22pF capacitance but if I only have something close then I go and use that.

    Resonators are not quite as accurate as crystals, which leaves them out of USB applications, but if I can use one I do use one. Spares the mess of 2 additional caps.

    (And just to be a sneaky devil and derail this thread: you can terminate the caps to Vdd or Vss, it just does not matter, so just use the closest one. )
     
  12. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,652
    767
    :eek: Didn't know that!
     
  13. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,652
    767
    Now that I think of it, I could say that I always used 33pF caps.
     
  14. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    I should have added it works because to an AC signal the power rails are shorted together... or they better be, that's what all those bleedin' bypass caps are for.
     
  15. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,570
    2,381
    Or as we always used to call them, DE-coupling capacitors. ;)
    Max.
     
  16. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    It's good layout design to surround the xtal with a ground plane and connect the two caps to that. Some of the SMD parts require it and show PCB layout examples in their datasheet.
     
Loading...