Can't get 18F2221 PLL to run with INTOSC


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default Can't get 18F2221 PLL to run with INTOSC

    I have -

    OSCTUNE =%01000000 ' bit 6 to turn on the PLL
    OSCCON = $F0 ' %11110000

    Location 0x300001 (Config1H) = 0xF9 , as confirmed by my ICD2

    OSC2 shows 2MHz, so the internal oscillator is running at 8MHz.

    But, my code is only executing at the 8MHz rate. I'm not getting
    the benefit of the PLL.

    What am I doing wrong?
    Charles Linquist

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    I have -
    OSCTUNE =%01000000 ' bit 6 to turn on the PLL
    OSCCON = $F0 ' %11110000
    Location 0x300001 (Config1H) = 0xF9 , as confirmed by my ICD2
    OSC2 shows 2MHz, so the internal oscillator is running at 8MHz.
    But, my code is only executing at the 8MHz rate. I'm not getting
    the benefit of the PLL.
    What am I doing wrong?
    According to Section 2.6.4 of DS39689E, the PLL will only work on the internal oscillator if you have 4 or 8Mhz selected, thereby giving you the option of 16 or 32Mhz.


    Then again, it is a 'Preliminary' datasheet...aren't they all? almost...

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    But I DO have 8 MHz selected.

    OSCCON <6:4> are "111"
    Charles Linquist

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    But I DO have 8 MHz selected.

    OSCCON <6:4> are "111"
    Well, then, let's see some code. Might be some extra 'hidden' instructions in there that you aren't catching.

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    ASM
    ifndef __18F2221
    error "Wrong Processor Type"
    endif
    ENDASM

    DEFINE OSC 32
    DEFINE NO_CLRWDT 1
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_TXSTA 24H
    DEFINE HSER_CLROERR 1
    DEFINE LOADER_USED 1 ' Tell compiler to relocate code for bootloader
    Define USE_LFSR 1



    TRISA = %11111111
    TRISB = %11111110
    TRISC = %10111111

    ADCON1 = $FF ' Start as all digital
    CMCON = %00000111 ' No Comparator used, turn it off
    ADCON2 = %10000110 ' Right Justify, /64
    OSCTUNE =%01000000 ' bit 6 to turn on the PLL
    OSCCON = %01110000 ' %11110000
    TopLoop:
    Toggle PORTB.0
    PAUSE 10
    GOTO TopLoop
    Charles Linquist

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    So you're only getting about 12.5Hz on PortB.0?

Similar Threads

  1. Program compiles and writes but can't run
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 23rd March 2009, 04:38
  2. 18F4520 and internal osc & PLL
    By pwhitt in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th September 2008, 06:38
  3. 16F628 and LMX2306 PLL loading.. help
    By kessral in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2008, 17:03
  4. Pll?
    By atwoz in forum General
    Replies: 2
    Last Post: - 19th December 2007, 10:20
  5. Cannot compile for 40MHz 4 x pll
    By passion1 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 21st October 2007, 17:50

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