Oscillator/Hserout woes


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HankMcSpank View Post
    Having got the define correct. (define osc 4 ....4Mhz)

    The OSCCON still needs setting? (bear with me here - I seldom change this stuff.....if OSCCON still needs setting what's the purpose of the DEFINE command?)

    I tried getting the interal oscillator presented on the associated IO pins (to see if I could scop them - failed! IS there something unique about the clock that makes it invisible? lol)

    I tried a whole heap of permutations - the Hserout settings I posted were derived from Mr E's calculator.
    No, you were correct, it defaults to 4 mhz, and should not need to be set, unless you want to try 8 mhz. Which, maybe you should, just for fun. But try what Henrik suggested with verifying your osc speed by toggling an led, and see what you get, just to be sure.
    Last edited by ScaleRobotics; - 10th October 2010 at 17:43.
    http://www.scalerobotics.com

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,622


    Did you find this post helpful? Yes | No

    Default

    Hi,
    DEFINE OSC 4 doesn't do anything with the PICs registers or config "fuses". It simply tells the compiler that you are intending to run the chip at 4Mhz so it knows how to calculate the correct amount of cycles for your PAUSE 250 etc.

    The internal oscillator on the '690 is fixed* at 8Mhz but the postscaler (controlled by bits 4, 5 and 6 in the OSCCON register) defaults to a divide by 2 ratio so you end up with 4Mhz as the default. So really, it should be running at 4Mhz.

    * The "fixed" 8Mhz oscillator can be tuned by changing the OSCTUNE register.

    When you tried to get the CLKOUT to work, did you set the pin to output? (TRISA.4 = 0)

    /Henrik.

    EDIT: Running at 4Mhz you should see a 1Mhz signal on the CLKOUT pin.

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    DEFINE OSC 4 doesn't do anything with the PICs registers or config "fuses". It simply tells the compiler that you are intending to run the chip at 4Mhz so it knows how to calculate the correct amount of cycles for your PAUSE 250 etc.

    The internal oscillator on the '690 is fixed* at 8Mhz but the postscaler (controlled by bits 4, 5 and 6 in the OSCCON register) defaults to a divide by 2 ratio so you end up with 4Mhz as the default. So really, it should be running at 4Mhz.

    * The "fixed" 8Mhz oscillator can be tuned by changing the OSCTUNE register.

    When you tried to get the CLKOUT to work, did you set the pin to output? (TRISA.4 = 0)

    /Henrik.

    EDIT: Running at 4Mhz you should see a 1Mhz signal on the CLKOUT pin.
    Great stuff Henrik - like I say, in the end I went back to 20Mhz (& all the associated pin rejigging that entails from having to put back in the an external resonator!)...I don't have the heart or inner strength to now 'rejg' my 'rejig' so to speak ......but I *will* revisit this with the advice/knowledge gained here (I'd dearly love to see some form of clock coming out of the pesky pins - if for no other reason to establish that the PIC isn't holding a grudge against me!)

    A hearty thanks!

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Hey Hank, when you do have the heart to re-visit this, use the int_osc clk_out fuse instead of no clk out. This should put the clock on whatever pin it says. As for rejigging pins, can you just pull your resonator to test between internal and external?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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