![Microchip Technology PIC12F1501 Manual Download Page 272](http://html1.mh-extra.com/html/microchip-technology/pic12f1501/pic12f1501_manual_1785833272.webp)
2011-2015 Microchip Technology Inc.
DS40001609E-page 273
PIC16(L)F1508/9
25.0
NUMERICALLY CONTROLLED
OSCILLATOR (NCO) MODULE
The Numerically Controlled Oscillator (NCOx) module
is a timer that uses the overflow from the addition of an
increment value to divide the input frequency. The
advantage of the addition method over simple counter
driven timer is that the resolution of division does not
vary with the divider value. The NCOx is most useful for
applications that require frequency accuracy and fine
resolution at a fixed duty cycle.
Features of the NCOx include:
• 16-bit increment function
• Fixed Duty Cycle (FDC) mode
• Pulse Frequency (PF) mode
• Output pulse width control
• Multiple clock input sources
• Output polarity control
• Interrupt capability
is a simplified block diagram of the NCOx
module.
25.1
NCOx Operation
The NCOx operates by repeatedly adding a fixed value
to an accumulator. Additions occur at the input clock rate.
The accumulator will overflow with a carry periodically,
which is the raw NCOx output (NCO_overflow). This
effectively reduces the input clock by the ratio of the
addition value to the maximum accumulator value. See
The NCOx output can be further modified by stretching
the pulse or toggling a flip-flop. The modified NCOx
output is then distributed internally to other peripherals
and optionally output to a pin. The accumulator
overflow also generates an interrupt (NCO_interrupt).
The NCOx period changes in discrete steps to create
an average frequency. This output depends on the
ability of the receiving circuit (i.e., CWG or external
resonant converter circuitry) to average the NCOx
output to reduce uncertainty.
25.1.1
NCOx CLOCK SOURCES
Clock sources available to the NCOx include:
• HFINTOSC
• F
OSC
• LC1_out
• CLKIN pin
The NCOx clock source is selected by configuring the
NxCKS<2:0> bits in the NCOxCLK register.
25.1.2
ACCUMULATOR
The accumulator is a 20-bit register. Read and write
access to the accumulator is available through three
registers:
• NCOxACCL
• NCOxACCH
• NCOxACCU
25.1.3
ADDER
The NCOx adder is a full adder, which operates
independently from the system clock. The addition of the
previous result and the increment value replaces the
accumulator value on the rising edge of each input clock.
25.1.4
INCREMENT REGISTERS
The increment value is stored in two 8-bit registers
making up a 16-bit increment. In order of LSB to MSB
they are:
• NCOxINCL
• NCOxINCH
When the NCO module is enabled, the NCOxINCH
should be written first, then the NCOxINCL register.
Writing to the NCOxINCL register initiates the incre-
ment buffer registers to be loaded simultaneously on
the second rising edge of the NCOx_clk signal.
The registers are readable and writable. The increment
registers are double-buffered to allow value changes to
be made without first disabling the NCOx module.
When the NCO module is disabled, the increment
buffers are loaded immediately after a write to the
increment registers.
EQUATION 25-1:
Note:
The increment buffer registers are not
user-accessible.
F
OVERFLOW
NCO
Clock
Frequency
Increment
Value
2
n
----------------------------------------------------------------------------------------------------------------
=
n = Accumulator width in bits