+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2017
    Posts
    27

    Default 18F4680 Internal Oscillator

    I am working with the 18F4680 and for some reason can't get the internal oscillator to work. The external works fine.
    I may need to also configure config1H, but it seems everything I did to try that would result in a compile error message. Is there something else I am missing?

    I tried the below and it resulted in compiler error
    #CONFIG
    _CONFIG _OSC_IRCIO67_1H
    #ENDCONFIG



    I edited the PIC18F4680.PBPINC by changing the #CONFIG section from CONFIG OSC = HS to CONFIG OSC = IRCIO67. This did compile with no error, but also wouldn't run.


    This is the code which I think should work.


    OSCCON = $72 ' Set internal 8Mhz OSC
    'OSCCON = %11100010 ' Set internal 4Mhz OSC
    #Config
    CONFIG OSC = IRCIO67 ;Sets for internal oscillator
    #endconfig


    DEFINE OSC 8 'Sets Osc to 8MHZ




    'Setup
    ADCON0 = $00 'Disables A/D module
    ADCON1 = $0F 'Sets inputs to digital
    CMCON = $07 'Takes pins D<3:0> to digital from default PW mode

  • #2
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    314

    Default Re: 18F4680 Internal Oscillator

    This may or may not get you where you want to be, but if you go to C:\\Programs(x86)\PBP3_1\DEVICE_REFERENCE you will have a list of every PIC processor PBP can program. Click on your 18F4680. What will open is the CONFIG Registers. At the top is the default settings. You can copy/paste that section into the top of your code, removing the comments. In the document are all of the options available. You can go through them, with the help of the data sheet, and change them as needed. It may be that you aren't getting what you want because of a different conflict than you think. Check it out.
    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.

  • #3

    Default Re: 18F4680 Internal Oscillator

    You might try setting OSCCON = $70

    That selects the primary clock (the one specified by the config OSC statement).
    That's required for a number of devices that have a PLL

  • Similar Threads

    1. How accurate is the internal oscillator ?
      By lilimike in forum mel PIC BASIC Pro
      Replies: 5
      Last Post: - 13th May 2010, 05:06
    2. Internal oscillator please help
      By timbash in forum mel PIC BASIC Pro
      Replies: 9
      Last Post: - 26th February 2009, 14:11
    3. Internal Oscillator
      By jhorsburgh in forum General
      Replies: 2
      Last Post: - 10th December 2007, 02:13
    4. How to use Internal Oscillator?
      By xobx in forum mel PIC BASIC Pro
      Replies: 4
      Last Post: - 18th September 2007, 19:49
    5. Serial com with internal oscillator
      By mikendee in forum Serial
      Replies: 5
      Last Post: - 14th June 2007, 20:24

    Members who have read this thread : 15

    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