FOSC - settings, can some carify please.

Discussion in 'Embedded Systems and Microcontrollers' started by Hoylegj, Apr 13, 2016.

  1. Hoylegj

    Thread Starter New Member

    Mar 10, 2016
    16
    1
    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: Apr 13, 2016
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Confirm your part number, that one isn't real.
     
  3. odm4286

    Active Member

    Sep 20, 2009
    155
    5
    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.
     
  4. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,676
    899
    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
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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.
     
  6. Hoylegj

    Thread Starter New Member

    Mar 10, 2016
    16
    1
    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: Apr 13, 2016
  7. dannyf

    Well-Known Member

    Sep 13, 2015
    1,775
    360
    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.
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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."
     
Loading...