PIC16F886 internal clock settings

For general Flowcode discussion that does not belong in the other sections.
Post Reply
walbeek
Posts: 38
http://meble-kuchenne.info.pl
Joined: Thu Dec 17, 2020 3:25 pm
Location: Netherlands
Been thanked: 2 times

PIC16F886 internal clock settings

Post by walbeek »

Hi there,

I use a PIC16F886 for current measuring.
Six of the analogue inputs are connected to ZXCT1086Q sensors.
When the analogue input is high, one of the outputs is high to.

The controller runs with a 20MHz crystal.
When the input stays high, the output has to stay high to.
However, after a random time, sometimes the output goes low for a few milliseconds.
I think it may help when the 16F886 runs a little slower, 20MHz is the max.

The PIC16F886 has a 8MHz internal oscillator (pic 01)
I can't figure out how this can be selected (pic 02)

I have included the Flowcode also.
Can anybody point me in the right direction here?
Thanks,

Rinie
Attachments
9088 - Stroometing V001b.fcfx
(58.89 KiB) Downloaded 18 times
Pic-02.jpg
Pic-02.jpg (41.9 KiB) Viewed 71 times
Pic-01.jpg
Pic-01.jpg (97.44 KiB) Viewed 71 times
Best regards,

Rinie

medelec35
Valued Contributor
Posts: 2325
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 724 times
Been thanked: 783 times

Re: PIC16F886 internal clock settings

Post by medelec35 »

Hello.
The default frequency of the internal osc is 4MHz.
What you will need to do to change it from 4MHz to 8MHz.
To do that you will need to add Int Osc Helper which can be found within Component Libraries > Runtime > Matrix Tools.
After adding to the 2D panel, Right click on it and select Help.
That will give you the instructions to set up your project to run the internal osc at 8MHz.
Martin

walbeek
Posts: 38
Joined: Thu Dec 17, 2020 3:25 pm
Location: Netherlands
Been thanked: 2 times

Re: PIC16F886 internal clock settings

Post by walbeek »

Hello Martin,

Thanks for your reply.
To be sure, I have to select "Internal RC clockout" in the Project options?
There is no INTOSC in the project options list to choose.
Or is this overruled with the C code?

Rinie
Best regards,

Rinie

medelec35
Valued Contributor
Posts: 2325
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 724 times
Been thanked: 783 times

Re: PIC16F886 internal clock settings

Post by medelec35 »

Within Project Options, you either select Internal RC no clock, or Internal RC Clockout.
The latter uses the OSC2/CLKOUT pin and the output is FOSC/4.
The actual frequency is not changed within Project Options.
The Clock speed within Project Options does not change the actual internal osc speed.
Its purpose is to be used with components and delays for timing purposes.
What changes the internal OSC frequency is the value of the OSCCON register via a C code block.
By changing the values within the C code shown within the Internal Oscillator Helper component, the frequency of the osc will be changed. For example, using OSCCON = 0x70; the internal osc will change from the default 4 MHz to 8 MHz.
As per instructions on the wiki, within the properties of the Internal Oscillator Helper component, select the required frequency, and copy the code to be pasted within the C code block at the very top of Main.
Martin

Post Reply