View previous topic :: View next topic |
Author |
Message |
Andreas
Joined: 25 Oct 2004 Posts: 136
|
Oscillator settings PIC16F1718 |
Posted: Mon Aug 31, 2015 7:10 am |
|
|
Hi friends
I have to migrate from 16F886 to 16F1718 and now I am getting confused with the settings for oscillator.
This doesn't make an error but the speed is 16MHz
Code: | setup_oscillator(OSC_16MHZ | OSC_INTRC | OSC_PLL_ON); |
According to the datasheet i made this:
Quote: | setup_oscillator(OSC_8MHZ | OSC_INTRC | OSC_PLL_ON); |
So i guessed it should run now on 32MHz, but that's not true !
It is still running on 8MHz.
BTW, at all times I used this :
Code: | #use delay(clock=8000000) |
So I should be able to see a difference in a blinking LED ???
Can anybody see my mistake ???
I hope someone can help me on this.
Best regards
Andreas |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Mon Aug 31, 2015 7:25 am |
|
|
The joys of some of the modern chips.....
Key problem is: 'OSC_INTRC'.
Look at the oscillator diagram. Figure 6-1.
If you select OSC_INTRC, you are setting the SCS 1:0 bits to 1x. If you look at the diagram, you will see that using this route, you can't access the PLL. The PLL is only available on the branch using 00 (primary oscillator). However the oscillator feeding this can be selected to be the external oscillator, or the internal oscillator, using the 'PRIMUX' bit (primary multiplexer).
So the correct selection for INTRC at 64MHz, is:
setup_oscillator(OSC_16MHZ | OSC_PLL_ON | OSC_NORMAL); |
|
|
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Mon Aug 31, 2015 12:10 pm |
|
|
Thank you Ttelmah.
Thanks for your answer, will test it tomorrow.
Best regards
Andreas |
|
|
|