Oscillator configuration for PIC18f2455


Closed Thread
Results 1 to 6 of 6
  1. #1
    Fritzengruber's Avatar
    Fritzengruber Guest

    Default Oscillator configuration for PIC18f2455

    Hi everyone,
    I am new to the world of Pic processors, and am having a bit of a problem. I am using a pic18f2455 on a custom made board to act as a motor controller by switching FETs, and have noticed that the chip seems to be running at 1/8th of the speed it should (a pause 1000 pauses 8 seconds instead of 1). I am not using the USB facilities, so I do not have an external oscillator,but am planning on just using the 8mhz internal oscillator. Using the command

    DEFINE OSC 8

    in picbasic doesnt seem to work, and leaving the oscillator speed undefined causes the chip to run at 1/4 speed.

    Is there some other configuration option I should be changing? Do I have to change the config bits?

    I just got this job after the guy before me was arrested, so I am having to pick up where he left off.

    Thanks for your help

    Fritz

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Why arrested?

    Was he working on something illegal?
    Are you continuing on his work?
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Fritzengruber's Avatar
    Fritzengruber Guest


    Did you find this post helpful? Yes | No

    Default

    Yes he was, but it had nothing to do with the project

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


    Did you find this post helpful? Yes | No

    Default

    DEFINE OSC 8

    in picbasic doesnt seem to work, and leaving the oscillator speed undefined causes the chip to run at 1/4 speed.

    Is there some other configuration option I should be changing? Do I have to change the config bits?
    sur eit have something to do with the config fuses... open then 18F2455.inc file in the PBP folder... you'll find those
    Code:
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    change them to
    [code]
    try to change with
    Code:
            __CONFIG    _FOSC_INTOSCIO_EC_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    and at the top of your code add
    Code:
    DEFINE OSC 8
    OSCCON=%01110000
    it should work... i should. Refer to the datasheet section 2.0
    Steve

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

  5. #5
    mark_wotton's Avatar
    mark_wotton Guest


    Did you find this post helpful? Yes | No

    Default Thanks!

    On behalf of Fritzengruber, who is now busily removing no-longer-needed 20MHz oscillator crystals, thank you very much - you've saved our bacon. If you're in Doha any time in the next 4 months, or in Sydney after that, look me up (Mark Wotton) and I'll buy you a beer or twelve.

    Cheers
    Mark

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


    Did you find this post helpful? Yes | No

    Default

    Twelve should be enough to start

    Nice to know it's working!
    Steve

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

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