Hello.
I use FC7 and I try make simple programm with internal oscillator enabled.
I added C-code in the begining of programm and set internall oscillator in options.
But PIC is work very slow. I want it be work on 8MHz.
Where is my mistake?
PIC18F2520 problem with OSCCON register
Moderator: Benj
-
- Posts: 71
- Joined: Mon Dec 01, 2014 1:38 pm
- Location: Bulgaria
- Has thanked: 17 times
- Been thanked: 12 times
- Contact:
PIC18F2520 problem with OSCCON register
- Attachments
-
- Int_Osc_Test.fcfx
- (8.02 KiB) Downloaded 193 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC18F2520 problem with OSCCON register
Hello,
That all looks correct to me. Have you tried the 1 second flash test to try and see what speed your actually running at?
https://www.matrixtsl.com/wikiv7/index. ... ED_flasher
That all looks correct to me. Have you tried the 1 second flash test to try and see what speed your actually running at?
https://www.matrixtsl.com/wikiv7/index. ... ED_flasher
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 71
- Joined: Mon Dec 01, 2014 1:38 pm
- Location: Bulgaria
- Has thanked: 17 times
- Been thanked: 12 times
- Contact:
Re: PIC18F2520 problem with OSCCON register
Thanks for the quick answer.
I found mistake. In test circuit board MCLR is unpinned.
I want PLL 4 MHz frequency in this mode/int osc/ to be 16MHz.
Do I do it right?
Because if I set 16MHz in options LED flash 4 times slow. If I set 4MHz it's Ok.
I found mistake. In test circuit board MCLR is unpinned.
I want PLL 4 MHz frequency in this mode/int osc/ to be 16MHz.
Do I do it right?
Because if I set 16MHz in options LED flash 4 times slow. If I set 4MHz it's Ok.
- Attachments
-
- Int_Osc_Test_Flasher.fcfx
- (8.01 KiB) Downloaded 185 times
-
- Posts: 71
- Joined: Mon Dec 01, 2014 1:38 pm
- Location: Bulgaria
- Has thanked: 17 times
- Been thanked: 12 times
- Contact:
Re: PIC18F2520 problem with OSCCON register
I solved it. Must change order of C-code
OSCTUNE=0x5F;
OSCCON=0x60;
to
OSCCON=0x60;
OSCTUNE=0x5F;
and frequency in settings must be 16MHz.
Apparently the order of writing is important.
OSCTUNE=0x5F;
OSCCON=0x60;
to
OSCCON=0x60;
OSCTUNE=0x5F;
and frequency in settings must be 16MHz.
Apparently the order of writing is important.