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
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
Comment