Confused with Clock / Oscillator

Discussion in 'Embedded Systems and Microcontrollers' started by ATM, Dec 7, 2009.

  1. ATM

    Thread Starter Member

    Oct 8, 2009
    Hello, i'm new to PIC programming and am using MPLAB with the Hi-Tech C compiler. I'm confused about firstly, how to set the PIC clock / oscillator and secondly, what values to actually use. I'm trying to use an internal oscillator.

    I've gone through the datasheet for the PIC im using (16F88) and rather arbitrarily decided to use an internal oscillator of 4MHz, i've then configured the register accordingly.

    Then when I was using MPLAB I went into the 'configuration bits' tab and noticed there was a setting called oscillator that was already set into code. My program so far looks like:


    So, do I still need to manually set the value of the OSCON register or is that already taken care of by the configuration bits? And what exactly does it mean when it says 'INTRC-OSC2 as RA6', if it's set up internally, why does it need to use Pin RA6?

    Any help is much appreciated, thanks.
  2. mik3

    Senior Member

    Feb 4, 2008
    If you use the configuration bits then it is not required to set the oscillator and all the things the configuration bits take care.

    'INTRC-OSC2 as RA6' means that the PIC will use the internal oscillator for its timing and the OSC2/RA6 pin can be used as an I/O pin.
  3. ATM

    Thread Starter Member

    Oct 8, 2009
    Ah I see, thanks for clearing that up.