Hi,
I am using PIC18f14K22 in my project.I want to use 16MHz internal Oscilator with PLL enable.
But OSCTUNE.PLLEN bit did not working.
I have write C code at the beginning in flowchart with these parameters, osccon = 0b01110110; osctune = 0b01011111;
and flash a led with 500ms delay in flowchart.and got 4 test using oscilloscope.
1st test with osctune = 0b01011111; //enable pllen bit
2nd test with osctune = 0b00011111; // disable pllen bit
3rd test with //osctune = 0b01011111;
4th test using timer0 at 1:128 prescaler (122.07Hz),using one counting variable,if variable >=61 , led on, otherwise off, if Variable=122,reset to zero.
Every test shown 1Hz frequency on scope.
I have also define frequecy in C code at the top # define _xtal_freq=16000000;
but same result at all.
Note: There is no external crystal attached in my circuit.
OSCCON , OSCTUNE register in datasheet and Config option shown below.
Best Reagrds
Sysprofessional
PLL Enabling Problem in 18f14k22
Moderator: Benj
- sysprofessional
- Posts: 54
- Joined: Sat Oct 26, 2013 7:16 pm
- Has thanked: 28 times
- Been thanked: 4 times
- Contact:
PLL Enabling Problem in 18f14k22
- Attachments
-
- OSCTUNE.png
- (76.92 KiB) Downloaded 1791 times
-
- OSCCON.png
- (129.03 KiB) Downloaded 553 times
-
- Config.png
- (58.07 KiB) Downloaded 1791 times
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: PLL Enabling Problem in 18f14k22
Hi Sysprofessional,
It would help us if you posted your flwochart as could have made a mistake within configuation settings.
Assuming you wish to run internal osc at 64MHz:
What you will need to do is either place at the very start on main a C code block with and enable PLL within config settings.
Since and pll enabed just sets internal osc to 16MHz x 4
You must also set the clock speed to 64MHz.
What you could also do if you have a scope is enable clockout and check the freqency is = 64MHz/4 = 16MHz
If still struggling i will help you to look further into this.
Martin
It would help us if you posted your flwochart as could have made a mistake within configuation settings.
Assuming you wish to run internal osc at 64MHz:
What you will need to do is either place at the very start on main a C code block with
Code: Select all
osccon=0x70;
Since
Code: Select all
osccon=0x70;
You must also set the clock speed to 64MHz.
What you could also do if you have a scope is enable clockout and check the freqency is = 64MHz/4 = 16MHz
If still struggling i will help you to look further into this.
Martin
Martin