basic question about OSCCON and HS_OSC


+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    98

    Default basic question about OSCCON and HS_OSC

    this is probably a pretty dumb question, but i have gotten rusty on PBP
    i have a design with the 16F819 chip and it was using INT OSC at 8MHz

    now i have a 20MHz resonator

    when i changed the DEFINE from
    INTRC_OSC_NOCLKOUT
    to
    HS_OSC

    it got me wondering what exactly happens with the OSCCON register ?
    is it now ignored?
    i looked at the data sheet and perhaps missed it but i could not see where it says anything about this the operations of the internal oscillator when an external xtal is used
    (i did determine by other means that the chip is running at 20MHz)

    is the int osc shut down or gated out entirely ?
    do any of the OSCCON bits now matter ?

    also with a 20MHz resonator (w/ internal caps) when i probe either pin with a scope it kills the oscillation, this is not hugely surprising but it got me wondering about whether for a resonator i should be using XT_OSC rather than HS_OSC
    as far as i know the HS is not for speed per se but rather for a drive level more appropriate for a higher freq xtal

    and lastly in the M16F81X.INC file i notice
    EC_OSC
    what is that ? i don't recall that one
    thanks
    Last edited by dsicon; - 8th December 2012 at 16:38.

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


    Did you find this post helpful? Yes | No

    Default Re: basic question about OSCCON and HS_OSC

    Quote Originally Posted by dsicon View Post
    this is probably a pretty dumb question,
    As they say, there are no dumb questions.
    when i changed the DEFINE from
    INTRC_OSC_NOCLKOUT
    to
    HS_OSC

    it got me wondering what exactly happens with the OSCCON register ?
    is it now ignored?
    i looked at the data sheet and perhaps missed it but i could not see where it says anything about this the operations of the internal oscillator when an external xtal is used
    (i did determine by other means that the chip is running at 20MHz)
    is the int osc shut down or gated out entirely ?
    do any of the OSCCON bits now matter ?
    Take a look at FIGURE 4-6 in the data sheet. The internal OSC is always running, the WDT works from it. The OSCCON is not ignored when HS is selected, just the internal OSC is not used as the main clock. The OSCCON bits do not matter when anything but the internal OSC is used.
    also with a 20MHz resonator (w/ internal caps) when i probe either pin with a scope it kills the oscillation, this is not hugely surprising but it got me wondering about whether for a resonator i should be using XT_OSC rather than HS_OSC
    as far as i know the HS is not for speed per se but rather for a drive level more appropriate for a higher freq xtal
    HS is the correct selection with resonators.
    and lastly in the M16F81X.INC file i notice
    EC_OSC
    what is that ? i don't recall that one
    thanks
    EC is for when an external clock source is used. Look at section 4.3 in the data sheet.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: basic question about OSCCON and HS_OSC

    Tip: To prevent killing the OSC with your probe, you want to use a 10x (or more) probe, and monitor the OSC2/CLKO pin.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: basic question about OSCCON and HS_OSC

    Quote Originally Posted by mister_e View Post
    Tip: To prevent killing the OSC with your probe, you want to use a 10x (or more) probe, and monitor the OSC2/CLKO pin.
    Hi Steve
    i do know about those 2 issues, pretty sure it was 10x probe, will double check and use a better scope too, if it actually was 10x that worries me a little about the drive level, will let you know

  5. #5
    Join Date
    Nov 2003
    Posts
    98


    Did you find this post helpful? Yes | No

    Default Re: basic question about OSCCON and HS_OSC

    Hi Dave and thank

    re EC, got it, rings a bell now, told you i got rusty

    re OSCCON i pretty much got it now but in your reply don't you say something contradictory ?
    you say 'OSCCON is not ignored ... '
    and you also say 'OSCCON bits do not matter ...'
    ?

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


    Did you find this post helpful? Yes | No

    Default Re: basic question about OSCCON and HS_OSC

    It is not ignored as far as the chip is concerned, the register is set either by you or by default, if you do not use the register then it does not matter how it is set.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Basic USB question(s)
    By muddy0409 in forum USB
    Replies: 1
    Last Post: - 20th May 2009, 21:19
  2. @ Device Pic16f84a, Hs_osc
    By chip_select in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th March 2008, 17:26
  3. what does OSCCON = $60 mean exactly?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th December 2005, 09:40
  4. I have there once a question to pic-Basic
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 12th February 2005, 19:06
  5. very basic question
    By scorpion in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2004, 10:25

Tags for this Thread

Posting Permissions

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