Hi
Just a quick question.
When trying out a "flash test" (1s on, 1s off) using the above chip on Int Osc, I am getting some serious delay.
With Osc set a 1Mhz the delays are doubled to around 2s
At 4Mhz the delays are around 8s
At 8Mhz the delays are around 16s
I'm guessing I need a block of C-Code at the start as FC might not be able to set the correct registors automatically?
Regards
16f1825 Int Osc settings
Moderator: Benj
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 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: 16f1825 Int Osc settings
Hello,
The default speed for the INTOSC on the device is 0.5MHz.
For 1MHz operation the line of C code at the start of your program needs to be
For 32MHz operation the line of C code at the start of your program needs to be.
The default speed for the INTOSC on the device is 0.5MHz.
For 1MHz operation the line of C code at the start of your program needs to be
Code: Select all
osccon = 0x58;
Code: Select all
osccon = 0xF0;
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
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: 16f1825 Int Osc settings
Hi Benj
Thanks for the quick reply.
I am using FC6 and the slowest oscillator setings under Build / General Options is 1Mhz for that chip. I added the C-Code you suggested at the start of my program (but with FC6 still set a 1Mhz) and tried.
The delays now appear to be 100ms or so.
Are the settings in Build / General Options messing things?
Regards
Thanks for the quick reply.
I am using FC6 and the slowest oscillator setings under Build / General Options is 1Mhz for that chip. I added the C-Code you suggested at the start of my program (but with FC6 still set a 1Mhz) and tried.
The delays now appear to be 100ms or so.
Are the settings in Build / General Options messing things?
Regards
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: 16f1825 Int Osc settings
First you look at the datasheet for the speed you would like internal oscillator to run at e.g 1MHz:this post on how to calculate correct osccon value.
Don't forget to set the clock speed in project options e.g 1000000.
If you still stuck then post flowchart.
Martin
Then you can follow Don't forget to set the clock speed in project options e.g 1000000.
If you still stuck then post flowchart.
Martin
Martin
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: 16f1825 Int Osc settings
Hi Martin
Changed the C-code to 0xd8 and it appears good. I was doing that as you posted. I had read in the datasheet that the default was 500Khz but as FC didn't offer that value it prompted me to ask about the C-code to override the config.
Thanks again you to and Benj
Regards
Changed the C-code to 0xd8 and it appears good. I was doing that as you posted. I had read in the datasheet that the default was 500Khz but as FC didn't offer that value it prompted me to ask about the C-code to override the config.
Thanks again you to and Benj
Regards
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: 16f1825 Int Osc settings
You can enter your own values for the clock speed by typing the value, the ones offered in the drop down are just often used defaults.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: 16f1825 Int Osc settings
Hi Kersing
Well peel my tangerines.... (to quote Lord Blackadder).
I did not know that.. Doh!
Thanks for that very useful snippet. I thought that as each chip had a drop down, that's what FC imposed. Guess I should really get out less and read more
Thanls again,
Regards
Well peel my tangerines.... (to quote Lord Blackadder).
I did not know that.. Doh!
Thanks for that very useful snippet. I thought that as each chip had a drop down, that's what FC imposed. Guess I should really get out less and read more

Thanls again,
Regards
-
- Valued Contributor
- Posts: 786
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 187 times
- Been thanked: 205 times
Re: 16f1825 Int Osc settings
Hi
Deleted the C-code and by directly entering 500Khz under Build etc it still seems to be running well.
Time now to make it do something more useful.
Thanks again to all
Regards
Deleted the C-code and by directly entering 500Khz under Build etc it still seems to be running well.
Time now to make it do something more useful.
Thanks again to all
Regards