25.3.3.2.2 NCO Pulse-Frequency Waveform Generation
In NCO Pulse-Frequency Waveform Generation mode, the TCF operates by repeatedly adding a fixed value defined by the TCFn.CMP to an accumulator (TCFn.CNT). Additions occur at the input clock rate. The accumulator will overflow with a carry periodically, the raw waveform output, effectively reducing the input clock by the ratio of the added value to the maximum accumulator value.
The waveform frequency (fFRQ) is defined by the following equation:
This makes a linear relationship between the increment value and the waveform frequency. This linear advantage over divide-by-n timers comes at the cost of the output jitter. However, the jitter that occurs periodically is always plus or minus one clock period, depending on the division remainder. For example, when there is no division remainder, then there is no jitter, whereas a division remainder of 0.5 will result in a jitter frequency one half of the overflow frequency.
In NCO Pulse-Frequency (NCOPF) mode, the output becomes active on the rising clock edge immediately following the overflow event. It goes inactive 1 to 128 clock periods later, determined by the WGPULSE bit field in TCFn.CTRLC. Prescaler is disabled in this mode, which gives a pulsed waveform output at the fFRQ frequency.
Each waveform pulse start generates a CMP0 event, and each waveform pulse end generates a CMP1 event. The interrupt flags are set simultaneously as the pulse events are generated.