8 MHZ internal configuration


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68

    Default 8 MHZ internal configuration

    On a PIC16F886, I have tried to use OSCCON to set the internal clock to 8 MHZ by changing OSCCON from 0x60 to 0x70. When I do that everything seems to stop. The default 0x60 works fine, but I would like it be able to use 8 MHz setting.

    I am using _WDT_OFF & _INTRC_OSC_NOCLKOUT

    I don't see anything else that needs to be set.

    What am I missing?
    PickyBiker says, "Riding a motorcycle eases programming frustration".

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Define osc 8
    ???
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    With a little more playing around, it seems that if I set _INTOSC instead of _INTRC_OSC_NOCLKOUT, it works. Looking at the datasheet I found a confusing set of clock descriptions: #5 and #6 below describe an EXTERNAL RC osc, while #7 and #8 describe and internal OSCILLATOR. What I don't see is where _INTRC_OSC_NOCLKOUT comes into play because it seems to refer to an INTERNAL RC osc, not the EXTERNAL described in #5 and #6 in the datasheet. Just call me Picky confused Biker.

    5. RC – External Resistor-Capacitor (RC) with
    FOSC/4 output on OSC2/CLKOUT.
    6. RCIO – External Resistor-Capacitor (RC) with I/
    O on OSC2/CLKOUT.
    7. INTOSC – Internal oscillator with FOSC/4 output
    on OSC2 and I/O on OSC1/CLKIN.
    8. INTOSCIO – Internal oscillator with I/O on
    OSC1/CLKIN and OSC2/CLKOUT.

    To add to the confusion, the .inc file shows these to be the same!!!
    _INTRC_OSC_NOCLKOUT EQU H'3FFC'
    _INTRC_OSC_CLKOUT EQU H'3FFD'
    _EXTRC_OSC_NOCLKOUT EQU H'3FFE'
    _EXTRC_OSC_CLKOUT EQU H'3FFF'
    _INTOSCIO EQU H'3FFC'
    _INTOSC EQU H'3FFD'
    Last edited by PickyBiker; - 30th April 2010 at 17:53.
    PickyBiker says, "Riding a motorcycle eases programming frustration".

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    7 and 8 do talk about the internal OSC.
    To find all of the available config option, go to Micrchip in your program file and look at the MPASM directory. There you will find another set of *.inc files for each chip. Do not modify these. At the end of each file the config options are listed.

    Here is the configs I use for this one.
    Code:
    @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
       OSCCON = %01110000
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Yes, I looked at the .inc file and got further confused because the two items in red are both defined as H'3FFC', yet one says there is no clock out, and the other says there is a clock out. This has to be a .inc file problem or, there is something about that that escapes me. The bottom line here is that I can make this work, but I do not understand why it works and why these things are defined the way they are.

    _INTRC_OSC_NOCLKOUT EQU H'3FFC'
    _INTRC_OSC_CLKOUT EQU H'3FFD'
    _EXTRC_OSC_NOCLKOUT EQU H'3FFE'
    _EXTRC_OSC_CLKOUT EQU H'3FFF'
    _INTOSCIO EQU H'3FFC'
    _INTOSC EQU H'3FFD'
    _EXTRCIO EQU H'3FFE'
    _EXTRC EQU H'3FFF'
    Last edited by PickyBiker; - 30th April 2010 at 18:18.
    PickyBiker says, "Riding a motorcycle eases programming frustration".

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    As far as I know just different ways of writing the same thing.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    You are correct dave.

    I took a break and went out to fly my RC plane. On the way home, I figured out what was tripping me up. It's really simple. _INTOSCIO EQU H'3FFC' is looking at things from the IO point of view. In that case, if the pins are IO, they are not clocks and vice-versa. _INTRC_OSC_NOCLKOUT EQU H'3FFC' is looking at things from the clock point of view so when the pins are not clocks, they are IO's, and vice versa. So, indeed, the two items I highlighted in the previous post are the same.

    Taking a break when you are banging your head against the wall is a good thing.
    PickyBiker says, "Riding a motorcycle eases programming frustration".

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts