Crystal osc running but PIC not using it


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2006
    Posts
    7

    Default Crystal osc running but PIC not using it

    I'm trying to use the PBP Count function with a bit more stability than the 16F690's internal RC oscillator provides.

    My problem is that I have the crystal oscillator running with the following edit to 16f690.inc file:
    ; __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF ------- original code
    __config _HS_OSC & _WDT_ON & _MCLRE_ON & _CP_OFF --------my edit

    BUT it matters not if I remove or short the crystal, the code still runs!
    I've checked the 4 MHz crystal's pins with a scope & counter and it is active at about 3999990 Hz, close enough to 4 MHz for me.
    MCLR is pulled high with a 4.7k Ohm resistor.

    What else do I have to do to enable the crystal oscillator internal to the PIC ?
    thanks
    Bob

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Your problem lies with the line

    __config _INTRC_OSC_NOCLKOUT

    The "_INTC_OSC" part means to use the internal oscillator.

    You should change this to "_XT_OSC" instead
    Charles Linquist

  3. #3
    Join Date
    Dec 2006
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    Your problem lies with the line

    __config _INTRC_OSC_NOCLKOUT

    The "_INTC_OSC" part means to use the internal oscillator.

    You should change this to "_XT_OSC" instead

    Well thanks but I did...notice the ";" commenting the "_INTC_OSC" line out.
    Changing to "_XT_OSC" has activity at the crystal as well as _HS_OSC did with the same result that pulling the crystal makes no difference, the code runs no matter.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Make sure your programmer is updating the CONFIG settings of the chip.
    Usually there's an option for that.

    It may still be using the CONFIG settings from a previous program.
    <br>
    DT

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default First 6 to 10 Lines

    Hi Bob,
    This particular PIC has special Oscillator, options and Has FSCM, which stands for Fail Safe Clock Monitor - datasheet page 49 of 294 and as I understand it, it automaticly deploys an internal clock when oscillator failure occurs, pretty darn nifty feature unless you are doing what You want to . Easiest way is use a cheaper PIC.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Easiest way is use a cheaper PIC.
    And never learn... not for me.
    Steve

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

  7. #7
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    And never learn... not for me.
    Me no understand . . . was I wrong?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    may bee hi deed not reed care foolee dee hole tred

    'The Easiest solution and use another PIC' reply always drive me nuts when the user don't need to and have a nice 'learning opportunitie' on hand... i know i may have badly interpret it anyways... Need to sleep... sorry

    Good news, you are right! Assuming the Fail-Safe clock monitor AND the int-ext-switchover mode are both enable, at POR, the internal OSC run @ 4MHz.... hence why it always work without noticeable bugs.
    Last edited by mister_e; - 18th February 2007 at 12:19.
    Steve

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

  9. #9
    Join Date
    Dec 2006
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Ah, thanks to Joe S. for the info. I have verified this by using a 4.91 Mhz crystal, far enough out to show errors in frequency counting.
    Pulling the crystal had the PIC instantly switch to it's internal RC source. THANKS!
    Bob

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    may bee hi deed not reed care foolee dee hole tred

    'The Easiest solution and use another PIC' reply always drive me nuts when the user don't need to and have a nice 'learning opportunitie' on hand... .
    ICE e e e e gotit EWE SCAERT MEE . . thought I missed something in de datasheet, possible as it was about 4 am here when I wrote that. HE HE You don't miss very many MASTER_E, I humble grasshopper, wish, only to learn . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. PIC with 100 kHz crystal
    By BrianT in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th January 2008, 09:09
  2. Can a PIC PIC a PIC?
    By afbecker in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd January 2008, 19:55
  3. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 20:42
  4. PIC 2 PIC communication
    By Mario in forum Forum Requests
    Replies: 16
    Last Post: - 28th April 2006, 01:56
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

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