1.1 NCO Output and PWM Output Comparison

This section provides the comparison between the NCO module and the traditional PWM module. When using a PWM module to generate a pulse train with variable frequency, use Figure   1 to calculate the PWM frequency.

Equation 1-1. PWM Frequency Calculation
F P W M = F O S C 4 ( P e r i o d V a l u e + 1 )

Where,

F P W M = Desired frequency of PWM

F O S C = Oscillator clock frequency

P e r i o d V a l u e = Value loaded to Period Register

For an 8-bit Period Register, the value can vary from 0 to 255. With the oscillator clock frequency being fixed, the value in the Period Register determines the frequency of the PWM output. Since the Period Register value forms the denominator in Figure   1, any change in the value of Period Register will not yield a linear variation of FPWM, although the incremental change in the denominator or Period Register value is linear.

Figure   2 illustrates the variation of PWM frequency with respect to a corresponding change in the Period Register value.

Figure 1-3. Frequency vs. Period Value in PWM Module

The relation between the frequency of the NCO output and the incremental register is provided in Figure   3. From Figure   3, note that FNCO is directly proportional to the increment value, and the accumulator overflow value is always fixed to 220 = 1048576. Therefore, any change in the increment value will yield a very linear variation in the output frequency of the NCO (i.e, FNCO).

Equation 1-2. PWM Frequency Calculation Using NCO Module
F N C O = ( F O S C A c c u m u l a t o r ) ( I n c r e m e n t V a l u e )

Where,

FNCO = Frequency of the output NCO module

FOSC = Oscillator clock frequency (about 16 MHz)

Accumulator = 20 bit summing register that overflows to create an output transition

Increment Value = Value loaded to change FNCO

This concept illustrates the variation of FNCO with a corresponding change in the increment value, see Figure   4.

Figure 1-4. Frequency vs. Increment Value in NCO Module

Therefore, a better frequency resolution over a wide frequency range can be obtained using the NCO for waveform generation, when compared to the conventional PWM-based approach.