Announcement

Collapse
No announcement yet.

ME Labs Trainer Manual -- Clock Setting Confusion

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ME Labs Trainer Manual -- Clock Setting Confusion

    ME Labs Trainer Manual Clock Setting Confusion

    The ME Labs Manual in Paragraph 14.4 provides the following instruction for setting the clock freq to 16 Mhz.
    -----------------------------------------------------------------------------------
    Our code sets OSCCON here:

    OSCCON = %01111000 ' Set internal osc to 8MHz with a 4x PLL enabled
    '(4 x 8MHz = 16MHz).

    The above setting will make the micro run with a 16MHz clock frequency. This is what we'll be using for almost all the examples in this document.

    14.5 Code: DEFINE OSC
    At this point, the microcontroller is configured and initialized to run on the internal oscillator at 16MHz. To allow PBP to accurately calculate execution times, we need to advise it of our 16MHz intent. To do so, we use a PBP DEFINE:
    DEFINE OSC 16 ' Tell PBP that the device will clock at 16MHz

    ------------------------------------------------------------------------

    Note: PLLEN in Configuration word is OFF.

    It appears to me…. That OSCCON bits 6-3 are set to 1111, which sets the oscillator freq to 16 Mhz and bit 7 being a 0 disables the 4x PLL? I think the end result is a 16 Mhz clock, but does not follow the explanation.

    Thanks,

    Larry Cardo

  • #2
    Hi larry ...

    you definitly need to read your manual and datasheets ...

    OSCCON sets the Pic Chip internal osc. to the desired frequency ...

    DEFINE OSC tells the Compiler it must adjust its timing related commands to the frequency you have chosen with the OSCCON setting ...

    note I made it short here ...

    Alain

    Comment


    • #3
      Actually, I believe Larry has found an error in the document. The OSCCON setting does set the clock at 16MHz without PLL, but the comments incorrectly say 32MHz by way of 8MHz with the x4 PLL.

      Good catch, Larry, and very attentive reading. I'll fix the comments for the next release. 16MHz is the intended frequency.
      Charles Leo
      ME Labs, Inc.
      http://melabs.com

      Comment


      • #4
        Thanks for the clarification Charles. I am loving the ME Labs Trainer and the manual.

        Larry

        Comment

        Working...
        X