• MPLAB XC8
  • How to configure the external crystal with PLL
2020/11/24 05:28:15
Nera
Hi guys,
How can I configure an external 8 Mhz oscillator crystal and turn on the PLL to result in 32 Mhz?
What configuration bits should I change and what commands should I run?
The microcontroller I am using is the PIC18F4620.
 
Thanks.
2020/11/24 07:03:27
BroadwellConsultingInc
I'd suggest creating a simple project in Microchip Code Configurator that does what you want.  It will also help you set up clocks for other peripherals you may want to use such as UART.  Even if it's an assembly project it will be easy to see the Config word and register values.
 
An important thing to note about that family is that the crystal / PLL settings are read from the config bits at powerup, not reset.  So if you make changes to the config bits you need to power cycle the chip for them to take effect.  Just doing a reset with your PicKit or ICD won't do it.  It will look like your change didn't do anything.
2020/11/24 07:59:16
1and0
Neraildes
How can I configure an external 8 Mhz oscillator crystal and turn on the PLL to result in 32 Mhz?
What configuration bits should I change and what commands should I run?
The microcontroller I am using is the PIC18F4620.

Connect your crystal with two 22 pF to the PIC device, and use the HSPLL config bits setting.
 
2020/11/24 10:28:54
crosland
Have you tried RTFM?
2020/11/24 15:21:24
upand_at_them
Is there a quick start guide we can direct beginners to?
2020/11/24 16:31:02
BroadwellConsultingInc
In my opinion, any quickstart guide would probably use an internal oscillator.  And I feel like the MCC route is the quickstart method for most people.  
2020/11/24 18:23:42
upand_at_them
I meant a quick start guide for using a crystal.  Telling people to "RTFM" isn't as helpful as one might think; most beginners will be baffled by a datasheet that's 500+ pages.
2020/11/24 21:29:49
du00000001
upand_at_them
I meant a quick start guide for using a crystal.  Telling people to "RTFM" isn't as helpful as one might think; most beginners will be baffled by a datasheet that's 500+ pages.



The oscillator section is less than 20 pages in the ..FM. One would expect that this little could be read and understood, although my daily experience differs.
2020/11/24 22:45:22
mpgmike
First question; if you have the option of using an internal oscillator, why would you opt for a crystal?
 
Second question; with the blessing of numerous "modern" PIC chips, why do you choose the PIC18F4620?
 
Third question; I see you have over 200 posts.  Have you successfully programmed a "Hello World" or even more complex program yet?
 
Fourth question; out of curiosity, what are you ultimately hoping to accomplish?
2020/11/25 02:11:06
crosland
mpgmike
First question; if you have the option of using an internal oscillator, why would you opt for a crystal?
 



Numerous reasons. CANbus for example.
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account