Internal osc PIC12F683

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Internal osc PIC12F683

Post by MJU »

I want to make the most out of a PIC 12F683.
This means that I want it to run on an internal oscillator.

In the datasheet there is an "High-Frequency Internal Oscillator (HFINTOSC)".
It has a setting between 8Mhz and 125khz, selectable with the "OSCTUNE register"

My question is rather difficult.
How (from scratch) do I set Flowcode to make the PIC 12f683 run at 8Mhz?

My guess is to set in "expert config screen" the oscillator to HS?
But then I don't see an option to set the clock speed..

Any help is welcome!

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: Internal osc PIC12F683

Post by fotios »

Hello MJU
Yes, you can use the internal RC module of P12F683 and to have available 2 more pins for I/O. In FlowCode "expert Configuration screen" you must select: Oscillator = Internal RC No Clock. In the same screen you could select: Master Clear Enable = Internal. Thus you could have 6 pins as general I/O; the rest 2 are for supply. The related register of internal oscillator module is the OSCCON and after any reset (MCLR, BOR, POR and WDT) it gets automatically a value "-110 x000" that means Fosc = 4MHz If this oscillator frequency is suitable for your application, there is no need to do anything else. If you want a different Osc frequency like 8MHz in your case, then you have to add a C code command line after the begin of Main macro, using a "C icon". Click and drag the "C" icon after the "Begin" icon, double click on it to open the properties dialog box, delette everyting and place in the first line this command exactly: osccon = 0x70; (don't forget the ";" at the end of command). This command places the internall clock at 8MHz (hex 0x70 = 0111 0000 binary).
In page 20 of Microchip datasheet for P12F683 are reffered the values of OSCCON register bits IRCF2-IRCF1-IRCF0 which deffine the internal oscillator frequency.
Hope i helped you
Fotis
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 458
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 109 times
Been thanked: 117 times
Contact:

Re: Internal osc PIC12F683

Post by fotios »

Chinese proverb: One picture = 1000 words
In this case Two pictures = 2000 words. So, here two pics of what you have to do.
Attachments
Here the Configuration of P12F683
Here the Configuration of P12F683
todayConfig.jpg (140.11 KiB) Viewed 3425 times
Here the C command for Fosc = 8MHz
Here the C command for Fosc = 8MHz
todayFCD.jpg (74.11 KiB) Viewed 3425 times
Best Regards FOTIS ANAGNOSTOU

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: Internal osc PIC12F683

Post by MJU »

Thank you so very much.
Not only much gratitude on my behalf, but also from the two extra pins on the PIC!

THANK YOU

Post Reply