Propeller Manual

Table Of Contents
2: Spin Language Reference – _CLKMODE
Table 2-4: Valid Clock Mode Expressions and CLK Register Values
Valid Expression CLK Register Value Valid Expression CLK Register Value
RCFAST 0_0_0_00_000
RCSLOW 0_0_0_00_001
XINPUT 0_0_1_00_010
XTAL1 + PLL1X 0_1_1_01_011
XTAL1 + PLL2X 0_1_1_01_100
XTAL1 + PLL4X 0_1_1_01_101
XTAL1 + PLL8X 0_1_1_01_110
XTAL1 + PLL16X 0_1_1_01_111
XTAL1 0_0_1_01_010
XTAL2 0_0_1_10_010
XTAL3 0_0_1_11_010
XTAL2 + PLL1X 0_1_1_10_011
XTAL2 + PLL2X 0_1_1_10_100
XTAL2 + PLL4X 0_1_1_10_101
XTAL2 + PLL8X 0_1_1_10_110
XTAL2 + PLL16X 0_1_1_10_111
XINPUT + PLL1X 0_1_1_00_011
XINPUT + PLL2X 0_1_1_00_100
XINPUT + PLL4X 0_1_1_00_101
XINPUT + PLL8X 0_1_1_00_110
XINPUT + PLL16X 0_1_1_00_111
XTAL3 + PLL1X 0_1_1_11_011
XTAL3 + PLL2X 0_1_1_11_100
XTAL3 + PLL4X 0_1_1_11_101
XTAL3 + PLL8X 0_1_1_11_110
XTAL3 + PLL16X 0_1_1_11_111
The top object file in an application (the one where compilation starts from) can specify a
setting for
_CLKMODE in its CON block. This defines the initial clock mode setting for the
application and is the mode that the System Clock will switch to as soon as the application is
booted up and execution begins. The following examples assume that they are contained
within the top object file. Any
_CLKMODE settings in child objects are simply ignored by the
compiler. For example:
CON
_CLKMODE = RCFAST
This sets the clock mode for the internal, fast RC Clock/Oscillator circuit. The System Clock
would run at approximately 12 MHz with this setting. The
RCFAST setting is the default
setting, so if no
_CLKMODE was actually defined, this is the setting that would be used. Note
that the Clock PLL can not be used with the internal RC Clock/Oscillator. Here’s an example
with an external clock:
CON
_CLKMODE = XTAL1 + PLL8X
This sets the clock mode for an external low-speed crystal (XTAL1), enables the Clock PLL
circuit and sets the System Clock to use the 8x tap from the Clock PLL (
PLL8X). If an
external 4 MHz crystal was attached to XI and XO, for example, its signal would be
Propeller Manual v1.1 · Page 69