View previous topic :: View next topic |
Author |
Message |
hamid9543
Joined: 31 Jan 2013 Posts: 63
|
pic18f46j50+48 MHz crystal |
Posted: Sun Feb 16, 2014 12:24 pm |
|
|
hi
For create 12MIPS in pic18f46j50:
Should be use 48 MHz Crystal or use 16 MHz crystal with PLL ?.
Can you help me for config ccs? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19549
|
|
Posted: Sun Feb 16, 2014 12:27 pm |
|
|
You _must_ use the PLL, or an external oscillator module (not a crystal).
Read the data sheet. Look at what the maximum crystal frequency can be.
Same applies to the configuration required. The data sheet shows what oscillator and PLL settings are needed. |
|
|
hamid9543
Joined: 31 Jan 2013 Posts: 63
|
|
Posted: Wed Feb 19, 2014 11:38 pm |
|
|
i read data sheet .can you explain what different between crystal and oscillator. and how use PLL? i use pll and 40mhz crystal but micro not working properly. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Thu Feb 20, 2014 6:34 am |
|
|
a 'crystal' usually means a 2 pin metal can attached to the 'primary oscillator' pins with 2 caps.
an 'oscillator' is any 'device' or 'group of components' that make a 'clock' signal.
You need to printout figure 2-1 of the datasheet! That's the diagram of the 'family clock' which represents the various signal paths the PIC can use to create the required 'clock' signals.
Also table 29-10 lists the oscillator ratings. There you will see that when using an external crystal(and 2 caps) the MAXIMUM crystal value is 16MHz. So you cannot use any value higher( like 48 MHz) as the external crystal on the primary oscilator pins.
As for configuring this PIC with USB please do the following,
1) printout out figure 2-1,page 28 of datatsheet DS3931B
2) connect a 16MHZ xtal(and 2 caps) to the primary oscillator pins.
3) follow the 'flow' or 'signal path' to the PLL.Note that a 4MHz clock MUST be the USB PLL input.You've got a 16MHz xtal so you MUST divide by 4. Simple set the PLL prescaler to /4. This will give the required 4MHz input.
4)Notice underneath the PLL Prescaler there's a block called PLLEN, that must be enabled to allow the 48MHz clock to get to the USB module.
5) CPU speed can be set(configured)several ways, but if using the same 16MHz 'primary oscillator', look at the 'blocks' after the PLLEN block.This takes the 48MHz USB clock and feeds it into a 'CPUDivider' block.If you select '/3' then the CPU master clock will be 16MHz( 48/3). You also have to select the 2 other 'blocks' to get this signal to the CPU. Just follow the diagram.
With this PIC there are a great many options to get 'clocks' running!I've shown just one way using one crystal value.
When I do this I always printout the diagram, use a yellow 'highlighting' pen to show the signal paths.I use a 4MHz xtal for my projects as I have lots of them in stock.
hth
jay |
|
|
|