Propeller Manual

Table Of Contents
_CLKMODE – Spin Language Reference
Page 70 · Propeller Manual v1.1
multiplied by 16 (the Clock PLL always multiplies by 16) but the 8x bit result would be used;
the System Clock would be 4 MHz * 8 = 32 MHz.
CON
_CLKMODE = XINPUT + PLL2X
This sets the clock mode for an external clock-oscillator, connected to XI only, and enables
the Clock PLL circuit and sets the System Clock to use the 2x result. If an external clock-
oscillator pack of 8 MHz was attached to XI, the System clock would run at 16 MHz; that’s 8
MHz * 2.
Note that the Clock PLL is not required and can be disabled by simply not specifying any
multiplier setting, for example:
CON
_CLKMODE = XTAL1
This sets the clock mode for an external low-speed crystal but leaves the Clock PLL disabled;
the System Clock will be equal to the external crystal’s frequency.
The _CLKFREQ and _XINFREQ Settings
For simplicity, the examples above only show
_CLKMODE settings, but either a _CLKFREQ or
_XINFREQ setting is required to follow it so that objects can determine their actual System
Clock’s frequency. The following is the full version of the second example, above, with an
external crystal frequency (
_XINFREQ) of 4 MHz.
CON
_CLKMODE = XTAL1 + PLL8X 'low-speed crystal x 8
_XINFREQ = 4_000_000 'external crystal of 4 MHz
This example is exactly like the second example above, but _XINFREQ indicates that the
frequency of the external crystal is 4 MHz. The Propeller chip uses this value along with the
_CLKMODE setting to determine the System Clock frequency (as reported by the CLKFREQ
command) so that objects can properly adjust their timing. See
_XINFREQ, page 236.
_CLKMODE vs.CLKMODE
_CLKMODE is related to, but not the same as, CLKMODE. _CLKMODE is an application-defined
constant containing the requested clock mode at startup (in the form of clock setting constants
that are OR’d together) whereas
CLKMODE is a command that returns the current clock mode
(in the form of the CLK register’s bit pattern). Both may describe the same logical clock
mode but their values are not equivalent.