Page 1 of 1
Internal osc PIC12F683
Posted: Thu Aug 18, 2011 11:53 pm
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!
Re: Internal osc PIC12F683
Posted: Fri Aug 19, 2011 7:01 am
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
Re: Internal osc PIC12F683
Posted: Fri Aug 19, 2011 7:33 am
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.
Re: Internal osc PIC12F683
Posted: Fri Aug 19, 2011 8:56 am
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