How to 18F25K22 osc settings ?


+ Reply to Thread
Results 1 to 10 of 10

Thread: How to 18F25K22 osc settings ?2704 days old

  1. #1
    Junior Member Maxi's Avatar
    Join Date
    Mar 2010
    Posts
    93
    Thumbs Up
    Received: 1
    Given: 25
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default How to 18F25K22 osc settings ?

    hi
    I need 16mhz and 64mhz internal osc setting

    for 16mhz
    Device = 18F25K22
    Xtal 16OSCCON.6=1
    OSCCON.5=1
    OSCCON.4=1

    for 64mhz
    Device = 18F25K22
    Xtal 16
    OSCCON.6=1
    OSCCON.5=1
    OSCCON.4=1
    OSCCON.3=0

    OSCCON.2=1
    OSCCON.1=1
    OSCCON.0=1
    Declare PLL_Req = On

    I add a simple code than I measure out (test on real circuit)

    While 1 = 1
    Toggle PORTC.4
    Wend

    when 16mhz, I measure 400.000 khz
    when 64mhz, I measure 400.000 khz


    whats wrong?

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Member John Lawton's Avatar
    Join Date
    Feb 2003
    Posts
    275
    Thumbs Up
    Received: 5
    Given: 16
    Total Downloaded
    1.35 GB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    Hi,

    try:
    Declare Xtal 64
    OSCCON = 111100 'set 16MHz internal osc frequency
    OSCCON2 = 000100 'select PLL as osc source
    OSCTUNE = 000000 'run at calibrated frequency, PLL is enabled

    [edit]
    and the fuse settings:

    Config_Start
    FOSC = INTIO67 ;Internal oscillator block
    PLLCFG = On ;Oscillator multiplied by 4
    PRICLKEN = On ;Primary clock is always enabled

    John
    Last edited by John Lawton; 26th September 2012 at 11:14.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Junior Member Maxi's Avatar
    Join Date
    Mar 2010
    Posts
    93
    Thumbs Up
    Received: 1
    Given: 25
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    no it is not run 64mhz
    Im read always 400khz out maximum

    I use many variation
    this codes doesnt work(I mean run 16mhz)


    Device = 18F25K22
    Declare Xtal=16

    ;-------------------------------------------------------------------------------
    ;**** Added by Fuse Configurator ****
    ; Use the Fuse Configurator plug-in to change these settings
    Config_Start
    FOSC = INTIO67 ;Internal oscillator block
    PLLCFG = On ;Oscillator used directly
    PRICLKEN = off ;Primary clock enabled
    FCMEN = OFF ;Fail-Safe Clock Monitor disabled
    IESO = OFF ;Oscillator Switchover mode disabled
    PWRTEN = On ;Power up timer enabled
    BOREN = NOSLP ;Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
    BORV = 250 ;VBOR set to 2.50 V nominal
    WDTEN = OFF ;Watch dog timer is always disabled. SWDTEN has no effect.
    WDTPS = 32768 ;1:32768
    CCP2MX = PORTC1 ;CCP2 input/output is multiplexed with RC1
    PBADEN = On
    CCP3MX = PORTC6 ;P3A/CCP3 input/output is mulitplexed with RC6
    HFOFST = On ;HFINTOSC output and ready status are not delayed by the oscillator stable status
    T3CMX = PORTC0 ;T3CKI is on RC0
    P2BMX = PORTC0 ;P2B is on RC0
    MCLRE = INTMCLR ;RE3 input pin enabled; MCLR disabled
    STVREN = OFF ;Stack full/underflow will not cause Reset
    LVP = OFF ;Single-Supply ICSP disabled
    XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    Debug = OFF ;Disabled
    CP0 = On ;Block 0 (000800-001FFFh) code-protected
    CP1 = On ;Block 1 (002000-003FFFh) code-protected
    CP2 = On ;Block 2 (004000-005FFFh) code-protected
    CP3 = On ;Block 3 (006000-007FFFh) code-protected
    CPB = On ;Boot block (000000-0007FFh) code-protected
    CPD = OFF ;Data EEPROM not code-protected
    WRT0 = OFF ;Block 0 (000800-001FFFh) not write-protected
    WRT1 = OFF ;Block 1 (002000-003FFFh) not write-protected
    WRT2 = OFF ;Block 2 (004000-005FFFh) not write-protected
    WRT3 = OFF ;Block 3 (006000-007FFFh) not write-protected
    WRTC = OFF ;Configuration registers (300000-3000FFh) not write-protected
    WRTB = OFF ;Boot Block (000000-0007FFh) not write-protected
    WRTD = OFF ;Data EEPROM not write-protected
    EBTR0 = OFF ;Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
    EBTR1 = OFF ;Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
    EBTR2 = OFF ;Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
    EBTR3 = OFF ;Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
    EBTRB = OFF ;Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
    Config_End
    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------

    OSCCON.6=1
    OSCCON.5=1
    OSCCON.4=1
    OSCCON.3=0
    OSCCON.2=1
    OSCCON.1=1
    OSCCON.0=1
    OSCCON2.7=1
    OSCCON2.4=0
    OSCTUNE.6=1

    Declare PLL_Req = On
    All_Digital = True

    TRISA=000000
    TRISB=000000
    TRISC=000000


    While 1 = 1
    Toggle PORTC.4
    Wend



    or this



    Device = 18F25K22
    Declare Xtal 64

    OSCCON = 111100 'set 16MHz internal osc frequency
    OSCCON2 = 000100 'select PLL as osc source
    OSCTUNE = 000000 'run at calibrated frequency, PLL is enabled

    Config_Start
    FOSC = INTIO67 ;Internal oscillator block
    PLLCFG = On ;Oscillator multiplied by 4
    PRICLKEN = On ;Primary clock is always enabled
    Config_End

    All_Digital=On

    TRISA=000000
    TRISB=000000
    TRISC=000000

    While 1 = 1
    Toggle PORTC.4
    Wend

    Last edited by Maxi; 26th September 2012 at 12:10.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Junior Member Maxi's Avatar
    Join Date
    Mar 2010
    Posts
    93
    Thumbs Up
    Received: 1
    Given: 25
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    power supply: 3.25 volt


    http://a1209.hizliresim.com/11/u/ddndx.png

    this is portc.4 out
    Click image for larger version

Name:	screenshot.jpg
Views:	18
Size:	20.3 KB
ID:	1602
    Last edited by Maxi; 26th September 2012 at 12:21.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Senior Member GAMBOA's Avatar
    Join Date
    Nov 2004
    Posts
    424
    Thumbs Up
    Received: 19
    Given: 0
    Total Downloaded
    203.73 MB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    Hi Maxi,

    This congig works for me to 64MHz internal osc.

    '***************************************
    '* FUSIBLES *
    '***************************************


    CONFIG_START

    FOSC=INTIO67 ; Internal oscillator block, port function on RA6 and RA7
    PLLCFG=ON ; Oscillator multiplied by 4
    PRICLKEN=OFF ; Primary clock can be disabled by software
    FCMEN=OFF ; Fail-Safe Clock Monitor disabled
    IESO=OFF ; Oscillator Switchover mode disabled
    PWRTEN=ON ; Power up timer enabled
    BOREN=SBORDIS ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
    BORV=285 ; VBOR set to 2.85 V nominal
    WDTEN=OFF ; Watch dog timer is always disabled. SWDTEN has no effect.
    WDTPS=32768 ; 1:32768
    CCP2MX=PORTB3 ; CCP2 input/output is multiplexed with RB3
    PBADEN=OFF ; PORTB<5:0> pins are configured as digital I/O on Reset
    CCP3MX=PORTB5 ; P3A/CCP3 input/output is multiplexed with RB5
    HFOFST=OFF ; HFINTOSC output and ready status are delayed by the oscillator stable status
    T3CMX=PORTC0 ; T3CKI is on RC0
    P2BMX=PORTB5 ; P2B is on RB5
    MCLRE=EXTMCLR ; MCLR pin enabled, RE3 input pin disabled
    STVREN=OFF ; Stack full/underflow will not cause Reset
    LVP=OFF ; Single-Supply ICSP disabled
    XINST=OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
    DEBUG=OFF ; Disabled
    CP0=ON ; Block 0 (000800-001FFFh) code-protected
    CP1=ON ; Block 1 (002000-003FFFh) code-protected
    CP2=ON ; Block 2 (004000-005FFFh) code-protected
    CP3=ON ; Block 3 (006000-007FFFh) code-protected
    CPB=ON ; Boot block (000000-0007FFh) not code-protected
    CPD=OFF ; Data EEPROM not code-protected
    WRT0=OFF ; Block 0 (000800-001FFFh) not write-protected
    WRT1=OFF ; Block 1 (002000-003FFFh) not write-protected
    WRT2=OFF ; Block 2 (004000-005FFFh) not write-protected
    WRT3=OFF ; Block 3 (006000-007FFFh) not write-protected
    WRTC=OFF ; Configuration registers (300000-3000FFh) not write-protected
    WRTB=OFF ; Boot Block (000000-0007FFh) not write-protected
    WRTD=OFF ; Data EEPROM not write-protected
    EBTR0=OFF ; Block 0 (000800-001FFFh) not protected from table reads executed in other blocks
    EBTR1=OFF ; Block 1 (002000-003FFFh) not protected from table reads executed in other blocks
    EBTR2=OFF ; Block 2 (004000-005FFFh) not protected from table reads executed in other blocks
    EBTR3=OFF ; Block 3 (006000-007FFFh) not protected from table reads executed in other blocks
    EBTRB=OFF ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks

    CONFIG_END
    And

    'REGISTER 2-1: OSCCON: OSCILLATOR CONTROL REGISTER
    IDLEN = 0 ': Idle Enable bit. 1 =Device enters Idle mode on SLEEP instruction; 0 =Device enters Sleep mode on SLEEP instruction
    IRCF2 = 1 ' Internal Oscillator Frequency Select bits, 111 = 16MHz
    IRCF1 = 1
    IRCF0 = 1
    OSTS = 0 ' Oscillator Start-up Time-out Status bit. Usar oscilador interno
    ' HFIOFS = OSCCON.2 ' HFINTOSC Frequency Stable bit. Solo de lectura
    SCS1 = 0
    SCS0 = 0 ' System Clock Select bits. Seleccionado Internal oscilator block
    and

    'REGISTER 2-2: OSCCON2: OSCILLATOR CONTROL REGISTER 2
    PRI_SD = 0 'Primary Oscillator Drive Circuit shutdown bit. 1 = Oscillator drive circuit on, 0 = Oscillator drive circuit off (zero power)
    ' HFIOFL = OSCCON2.1 ' HFINTOSC Frequency Locked bit. 1 = HFINTOSC is in lock, 0 = HFINTOSC has not yet locked
    ' LFIOFS = OSCCON2.0 'LFINTOSC Frequency Stable bit. 1 = LFINTOSC is stable. 0 = LFINTOSC is not stable
    'REGISTER 2-3: OSCTUNE: OSCILLATOR TUNING REGISTER
    INTSRC = 1 ' Internal Oscillator Low-Frequency Source Select bit; 1 = 31.25kHz device clock derived from 16MHz INTOSC source (divide-by-512 enabled); 0 = 31kHz device clock derived directly from INTRC internal oscillator
    PLLEN = 1 ' Frequency Multiplier Enable bit;1 = PLL enabled (for HFINTOSC 8 MHz and 16 MHz only); 0 = PLL disabled
    OSCTUNE.6 = 1
    TUN5 = 0 ' Frequency Tuning bits, 000000 = Center frequency; oscillator module is running at the calibrated frequency
    TUN4 = 0
    TUN3 = 0
    TUN2 = 0
    TUN1 = 0
    TUN0 = 0

    Regards,
    Gamboa

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Junior Member Maxi's Avatar
    Join Date
    Mar 2010
    Posts
    93
    Thumbs Up
    Received: 1
    Given: 25
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    yes its working now
    I can measure 1.6mhz
    thank you

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Member John Lawton's Avatar
    Join Date
    Feb 2003
    Posts
    275
    Thumbs Up
    Received: 5
    Given: 16
    Total Downloaded
    1.35 GB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    Glad you got it working at 64MHz, but puzzled as to why my config snippet didn't work for you. I'm sure my device is running at 64MHz too, maybe I'm lucky, but I have got 40 boards all working here as expected.

    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    Quote Originally Posted by John Lawton View Post
    Glad you got it working at 64MHz, but puzzled as to why my config snippet didn't work for you. I'm sure my device is running at 64MHz too, maybe I'm lucky, but I have got 40 boards all working here as expected.

    John
    Hi John,
    From post 2: 'OSCTUNE = 000000 'run at calibrated frequency, PLL is enabled' I can't see where you have PLL Enabled (OSCTUNE.6)

    Regards
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Member John Lawton's Avatar
    Join Date
    Feb 2003
    Posts
    275
    Thumbs Up
    Received: 5
    Given: 16
    Total Downloaded
    1.35 GB

    0 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    Hi Pic-ignorant, yes you're right, but now I notice that my config snippet was malformed anyway, the binary numbers have no preceding % symbols. I simply copy and pasted from working code, so I wonder what went wrong. Trying again:
    Code:
        OSCCON =  %01111100   'set 16MHz internal osc frequency
        OSCCON2 = %10000100   'select PLL as osc source
        OSCTUNE = %11000000   'run at calibrated frequency, PLL is enabled
    Sorry about my original errors, at least Maxi you are running now.

    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Junior Member jamachine's Avatar
    Join Date
    Jan 2019
    Posts
    3
    Thumbs Up
    Received: 1
    Given: 0
    Total Downloaded
    8.59 MB

    1 Not allowed!

    Default Re: How to 18F25K22 osc settings ?

    John, Thanks yours works just fine I have never made a 18f25k22 work with a eadog screen the config for these is way above my pay grade and yours made it work so thank you

    Stan

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. 18F25K22 Bootloader .....
      By moonshadow in forum Absolute Beginners Section
      Replies: 8
      Last Post: 7th May 2019, 06:53
    2. [SOLVED !] 18F26J13 Internal OSC Settings
      By NicHad in forum Oscillator Modules
      Replies: 5
      Last Post: 7th January 2014, 09:42
    3. PIC18F45k20 osc settings
      By ADLIN SYSTEMS in forum The Lounge
      Replies: 4
      Last Post: 7th August 2012, 14:09
    4. 18F25K22 and Pickit2
      By RGV250 in forum The Lounge
      Replies: 2
      Last Post: 30th July 2011, 23:11
    5. [SOLVED !] 18F25K22 bootloader
      By moonshadow in forum Proton Plus Compiler v3
      Replies: 16
      Last Post: 27th February 2011, 15:56

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts