Hi guys,
I’m trying to setup the internal oscillator for a 18F2580 mcu at 32Mhz using PLL but I have a few basic questions and just wanted to make sure I get it right…
As I can read from the datasheet, I need to set the config bit, osccon and osctune (and obviously define the OSC in the code).
For the config I used:
Code:
#CONFIG
CONFIG OSC = IRCIO67 ; Internal oscillator block, port function on RA6 and RA7
.
.
.
#ENDCONFIG
For osctune I selected the following bits (not real code format):
OSCTUNE.6=1 -> enable PLL
OSCTUNE 4-0=00000 -> Center frequency
For osccon I selected the following bits (not real code format):
OSCCON 6-4=111 -> select 8Mhz
OSCCON.7=0 -> Sleep when sleep command
However, for the osccon and osctune I have the following doubts…
OSCCON bits 1-0:
What is the difference between 1x=Internal oscillator block and 00=Primary oscillator?
OSCCON bit 2:
INTOSC frequency is stable or not stable…should I set this to 0?
OSCCON bit 3:
Should I set to 0 or 1?
OSCTUNE bit 7:
What is the difference between the 2 options?
“1 = 31.25 kHz device clock derived from 8 MHz INTOSC source (divide-by-256 enabled)
0 = 31 kHz device clock derived directly from INTRC internal oscillator”
Thanks
Bookmarks