PIC18F25K22 Oscillator Settings


Closed Thread
Results 1 to 6 of 6

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F25K22 Oscillator Settings

    PBP's default configuration for the 18F25K22 uses the Internal Oscillator for the Primary Oscillator.
    So all you need to do is set the OSCCON register.

    OSCCON = %01010000 ; 4Mhz
    OSCCON = %01100000 ; 8Mhz
    OSCCON = %01110000 ; 16Mhz

    Or, if you enable the PLL with ...

    OSCTUNE.6 = 1 ; Enable 4x PLL

    Then ...

    OSCCON = %01010000 ; 16Mhz
    OSCCON = %01100000 ; 32Mhz
    OSCCON = %01110000 ; 64Mhz

    Make sure your DEFINE OSC matches.
    DT

  2. #2
    Join Date
    Oct 2012
    Location
    Philadelphia Metro, PA
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: PIC18F25K22 Oscillator Settings

    Thanks Darrel...


    But, I guess that was not the only reason I am not getting this to work:

    Take a look below. I have simplified what I am trying to do. Everything was working fine with my PICDEM PIC18 explorer board. But when I went off and built my own circuitry, nothing is happening.

    I have external pull ups on the inputs. They are being pulled low, but the "output" pin is not doing anything at all. I dont 'think' it's electrical per se, because I am grounding the input pin manually.

    What am I missing??

    and by the way, it is OSCCON = %01010000 it does not show up correct on the code snippet for some reason.

    Code:
    DEFINE OSC 4
    OSCCON = 010000  ; 4Mhz
    ADCON1 = 15  ' All pins digital
    
    STROBE var PORTA.0
    STROBEOUT var PORTB.0
    
    STROBEOUT = 0 'just making sure that it is off
    
    do
      IF STROBE = 0 THEN
      PAUSE 10
      STROBEOUT = 1
      ELSE
      STROBEOUT = 0
      ENDIF
    loop

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18F25K22 Oscillator Settings

    ADCON1 = 15 ... Sets the Positive and Negative Voltage references to invalid "Reserved" values.
    It does not configure "All Digital" like it might on other chips.
    For the 18F25K22, it should be ...
    Code:
    ANSELA = 0
    ANSELB = 0
    ANSELC = 0
    Your STROBEOUT pin hasn't been set to OUTPUT.
    Either set the TRIS bit, use the OUTPUT command, or use HIGH and LOW commands.
    DT

Similar Threads

  1. PICs, CONFIGS and Oscillator Settings for Beginners
    By Demon in forum Code Examples
    Replies: 0
    Last Post: - 14th January 2012, 01:36
  2. 20MHZ External Oscillator Settings
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th October 2011, 01:44
  3. PIC18s and Oscillator settings
    By cc1984 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 4th October 2011, 18:50
  4. Settings for internal oscillator
    By mradde in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 10th February 2009, 19:11

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