FOSC - settings, can some carify please.

Thread Starter

Hoylegj

Joined Mar 10, 2016
26
I'm using a PIC18f45k50, and the FOSC has 3 bits, so the Mux Block diagram says

HF-16 mhz 111
HF-8 mhz 110
HF-4 mhz 101
HF-2 mhz 100
HF-1 mhz 011
HF-500 khz 010
HF-250 kHz 001

This fine, but in MPLAB you have the Config module, and that lists a set of defined names, like INTOSCIO, INTOSCCLKO

Ok, so I'm using #pragma config FOSC = INTOSCIO // Oscillator Selection (Internal oscillator) and it works.

But I can't find the definition in relations to the bits each config option is setting, these I believe set the FOCS<3:0> and other bits CFGPLLEN, PLSEL,PLLEN, SPLLMULT and PLL_Select.

I've searched various docs and all the headers but no joy, can't find the link between the configuration literals (INTOSCIO) and what bits accutualy get set.

Many thanks
Geoff
 
Last edited:

odm4286

Joined Sep 20, 2009
265
I'm using a PIC18f45k50, and the FOSC has 3 bits, so the Mux Block diagram says

HF-16 mhz 111
HF-8 mhz 110
HF-4 mhz 101
HF-2 mhz 100
HF-1 mhz 011
HF-500 khz 010
HF-250 kHz 001

This fine, but in MPLAB you have the Config module, and that lists a set of defined names, like INTOSCIO, INTOSCCLKO

Ok, so I'm using #pragma config FOSC = INTOSCIO // Oscillator Selection (Internal oscillator) and it works.

But I can't find the definition in relations to the bits each config option is setting, these I believe set the FOCS<3:0> and other bits CFGPLLEN, PLSEL,PLLEN, SPLLMULT and PLL_Select.

I've searched various docs and all the headers but no joy, can't find the link between the configuration and what bits accutualy get set.

Many thanks
Geoff
I'm new at this, but I believe you can just use the configuration bits in MPLAB. This will allow you to set the oscillation options. If I'm not mistaken, #pragma tells the compiler to set the necessary bits so you don't have to worry about dumping data into certain registers for chip behavior.
 

jpanhalt

Joined Jan 18, 2008
11,087
There still may be some other typos.

For that chip, it appears most of the register/bit settings are in section 3. SPLLMULT is in Table 3.7. CFGPLLEN is in 3.1, 26-1, and so forth. Just open the datasheet and search for each of the bits/registers about which you have a question.

John
 

ErnieM

Joined Apr 24, 2011
8,377
The search tool applied to the data sheet PDF will do wonders.

The first 4 items are well defined where they are. Finding the correct header for the config bits may be difficult, impossible for someone who has no idea what compiler you use.
 

Thread Starter

Hoylegj

Joined Mar 10, 2016
26
The search tool applied to the data sheet PDF will do wonders.

The first 4 items are well defined where they are. Finding the correct header for the config bits may be difficult, impossible for someone who has no idea what compiler you use.
It's a shame you didn't read my thread correctly, then you would know how silly you sound. But thank you for your help.
 
Last edited:

dannyf

Joined Sep 13, 2015
2,197
Ircfx buts control the internal high frequency RC oscillators output frequency on the run.

The other config bits are for which oscillator to use once the chip boots up.
 

ErnieM

Joined Apr 24, 2011
8,377
It's a shame you didn't read my thread correctly, then you would know how silly you sound. But thank you for your help.
The bigger shame is earning a place on my ignore list after just 15 posts.

As they say; "chump don wan the hep, chump don get the hep."
 
Top