GPS Project: PIC18F26K22 or PIC18F46K22


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    pause 10 is too little time.

    Maybe you need to make this 1000.

    Then check with a timer that it actually pauses every 1 sec confirming that osc is setup correctly.

    Recently I had similar matter setting up system oscillator again with 4xPLL and was running slow. Richard got it and we are OK now.

    Ioannis

  2. #2
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Quote Originally Posted by Ioannis View Post
    pause 10 is too little time.

    Maybe you need to make this 1000.

    Then check with a timer that it actually pauses every 1 sec confirming that osc is setup correctly.

    Recently I had similar matter setting up system oscillator again with 4xPLL and was running slow. Richard got it and we are OK now.

    Ioannis
    Ioanni,

    thanks a lot for the help. I'll do it tonight and try to increase the time.

    To be honest i made many changing to the pause commands like : 10ms , 100ms, 1000ms, 2000ms. All seem to work fine.

    It would be a good practice to see how could we identify that the PIC clock now is running at 64Mhz?

    Is there any way to measure this with an Oscilloscope? I believe that this is a question have been asked many times.

    If someone could help me to identify the cpu clock speed of the PIC with the new setting of external 16Mhz crystal and 4xPLL, i can do the testing, and share the information step by step in here. If there is already posted an example like this i would like to have a look at it.

    thanks a lot.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Is there any way to measure this with an Oscilloscope?
    measure the led on/off time with the Oscilloscope if the osc is correct then the on/off times will be as per your code


    I would leave CONFIG PWRTEN = ON


    AND ADD THIS
    OSCCON = %01110000 ; 64Mhz
    OSCTUNE.6 = 1 ; Enable 4x PLL
    while ! osccon2.7 :WEND

    to make sure the pll has stabilised before you run any other code , if timing is critical
    Warning I'm not a teacher

  4. #4
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Quote Originally Posted by richard View Post
    measure the led on/off time with the Oscilloscope if the osc is correct then the on/off times will be as per your code


    I would leave CONFIG PWRTEN = ON


    AND ADD THIS
    OSCCON = %01110000 ; 64Mhz
    OSCTUNE.6 = 1 ; Enable 4x PLL
    while ! osccon2.7 :WEND

    to make sure the pll has stabilised before you run any other code , if timing is critical
    Hi Richard,

    Thanks, i will do that. So that means that the 8th Bit of the OSCCON2 which is the .7 must be presented?
    Attached Images Attached Images  

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    I seldom use crystals [you lose two pins for marginal increase in accuracy ] but I believe you can set pll mode in the config section and is all you need

    CONFIG PLLCFG = ON
    ;CONFIG PLLCFG = OFF // pll can only be engaged with software selection for int osc


    and then all this is not valid , it applies to internal osc only

    OSCCON = %01110000 ; 64Mhz
    OSCTUNE.6 = 1 ; Enable 4x PLL


    this may or may not be necessary with xtal osc , I have found bootloaders won't sync up unless this is done using int osc with pll.
    the PLLRDY bit is asserted when pll is stable [although I can find no mention in data sheet]
    while ! osccon2.7 :WEND
    Warning I'm not a teacher

  6. #6
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Hi Richard,

    i got confused. Really im reading the datasheet and there is nowhere clear setting for using external crystal.

    I came up with the following

    Code:
    OSCCON = %01110000 ; 64Mhz
    OSCTUNE.6 = 1 ; Enable 4x PLL
    Because i was thinking that in order to specify the OSCCON, and the multiplier PLL we need to add those lines even if it is for internal or external source. I didnt think that those where valid only for internal OSC.

    So what should i add as OSCCON value, as i use and external crystal 16Mhz? How do i specify the OSCCON value for 64Mhz?

    thanks once again. Apologize for all my questions.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    So what should i add as OSCCON value, as i use and external crystal 16Mhz? How do i specify the OSCCON value for 64Mhz?
    nothing , leave it alone

    OSCTUNE.6 = 1 ; Enable 4x PLL becomes non functional if CONFIG PLLCFG = ON
    Warning I'm not a teacher

Similar Threads

  1. PIC18F46K22 config issue
    By LGabrielson in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th September 2012, 03:20
  2. Replies: 1
    Last Post: - 27th July 2008, 06:14
  3. Pic GPS project Demo
    By Art in forum GPS
    Replies: 0
    Last Post: - 28th October 2007, 03:05
  4. GPS project question
    By mjp130 in forum GPS
    Replies: 6
    Last Post: - 4th July 2007, 20:09
  5. gps project
    By chuckad in forum GPS
    Replies: 2
    Last Post: - 9th February 2007, 02:52

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