Page 1 of 1

PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 1:57 pm
by saakis
Hello Matrix and forum people!
Help me with config file for the pic 18f25k22. I want the internal oscillator 4x PLL and 16 MHz osc. So far I couldn't manage to do that... Give me a solution please!!!
Thank you!
Sakis

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 2:17 pm
by Benj
Hello Sakis,

Hopefully this should run as expected, let us know how you get on.
18F25K22.fcfx
(7.87 KiB) Downloaded 414 times

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 3:17 pm
by saakis
Thank you for your reply Benj but it doesn't work. First didn't complete the compilation because the osccon was in capital letters(!). After that just bring the first word 0x55 and stop there. I tried to change some parameters from the config but no success...
Sakis

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 3:32 pm
by Benj
Hello,

Sorry the register name was in v7 upper case format, v6 and earlier require lower case register names.
just bring the first word 0x55 and stop there.
Might be worth waiting a while, sounds like the device is running a lot slower than expected and hence the 1 second delay is taking many multiples of 1 second.

Try adding this to your C code after the osccon line to try and force the PLL to be enabled. You might also need to change the PLL config setting to disabled as it looks like the PLL and INTOSC can only be enabled via the osctune register.

Code: Select all

osctune = 0x40;  //Enable PLL
while ((osccon2 & 0x80) == 0);  //Wait for PLL to become stable
Let us know how you get on.

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 3:59 pm
by saakis
Hi benj,
doing the config below, I have 4 sec pulce but changing the osccon to 70 it stucks. I need 4 times faster pulses. Maybe the PLL is not enabled...
Regards
Sakis

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 4:25 pm
by Benj
Maybe try enabling the Internal/External Oscillator Switchover config setting, I seem to remember this helping on another device.

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 5:33 pm
by saakis
Hi Benj, still refuse to work...any other idea or I will use a crystal?
Regards

Re: PIC18F25K22 Internal clock config...

Posted: Tue Apr 04, 2017 5:42 pm
by Benj
Hello Sakis,

There will be a way to do it, the datasheet says it can be done.

I would have a thorough read of section 2 of the datasheet and see if you can pull out any pearls of wisdom. Googling for example code can also be a good way.

Re: PIC18F25K22 Internal clock config...

Posted: Wed Apr 05, 2017 10:49 pm
by saakis
Hi Benj,
finally it works.The only problem I have is that if I enable both A6 & A7 as I/O the prossesor stuck after 1 sec. If the A6 is configured as a Clockout port the PIC is fine...One I/O less!
Thank you for your help!