Propeller Manual

Table Of Contents
2: Spin Language Reference – CTRA, CTRB
CTRMODE
The CTRMODE field of
CTRA and CTRB selects one of 32 operating modes, shown in Table
2-7, for the corresponding Counter A or Counter B. In Propeller Assembly, the CTRMODE
field can conveniently be written, along with PLLDIV, using the
MOVI instruction.
The modes %00001 through %00011 cause
FRQx-to-PHSx, accumulation to occur every clock
cycle. This creates a numerically controlled oscillator (NCO) in PHSx[31], which feeds the
PLLx's reference input. The PLLx will multiply this frequency by 16 using its voltage-
controlled oscillator (VCO).
For stable operation, it is recommended that the VCO frequency be kept within 64 MHz to
128 MHz. This translates to an NCO frequency of 4 MHz to 8 MHz.
Using CTRA and CTRB
In Spin,
CTRx can be read/written just like any other register or pre-defined variable. As soon
as this register is written, the new operating mode goes into effect for the counter. For
example:
CTRA := %00100 << 26
The above code sets CTRA’s CTRMODE field to the NCO mode (%00100) and all other bits
to zero.
Propeller Manual v1.1 · Page 97