18F2450 internal osc


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    20

    Default 18F2450 internal osc

    I am trying to run a 18F2450 using the internal oscillator inlieu of a external osc, but i can't even get a led to blink. Here is the test code I am trying to get working before i write the real program.

    Code:
    define loader_used 1
     
    @ __CONFIG  _CONFIG1H, _FOSC_INTOSCIO_EC_1H
    @ __CONFIG  _CONFIG2H, _WDT_OFF_2H
    @ __CONFIG  _MCLRE_OFF_3H
    
    osccon = 00000010
    
    trisb = %1100000
    led var portb.3
    
    main:
       led = 1
       PAUSE 1000
       led = 0
       pause 1000
       GOTO MAIN
    end

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: 18F2450 internal osc

    Try this, and see if it works for you. There might be something else wrong, but for sure, you will need these.
    Code:
    define loader_used 1
     
    @ __CONFIG  _CONFIG1H, _FOSC_INTOSCIO_EC_1H
    @ __CONFIG  _CONFIG2H, _WDT_OFF_2H
    @ __CONFIG  _CONFIG3H, _MCLRE_OFF_3H
    @ __CONFIG  _CONFIG4L, _XINST_OFF_4L & _LVP_OFF_4L
    If that doesn't work, you could try adding in some of the default ones:
    Code:
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H,_PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
            __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _BBSIZ_BB1K_4L & _XINST_OFF_4L

  3. #3
    Join Date
    Jun 2005
    Location
    Surrey, England
    Posts
    35


    Did you find this post helpful? Yes | No

    Default Re: 18F2450 internal osc

    Two thoughts:
    1) I have found fuses are set by the loader fuse configuration, so no effect of changing them later
    2) OSCCON = 00000010 is not the same as OSCCON = %00000010, rather = %00001010 ie. decimal 10
    Peter
    PS TRISB assignment is 7 bit was that intentional?
    Last edited by FinchPJ; - 7th February 2011 at 05:38.

  4. #4
    Join Date
    Jun 2009
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: 18F2450 internal osc

    Thanks for the suggestions.

    I cleaned up the sloppy parts of the code and worked with the config fuses a bit, but i still had no luck. i finally gave in and added a external oscillator; i will revisit this when i have more time.

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