Datasheet

PIC16(L)F1782/3
DS41579D-page 234 Preliminary 2011-2012 Microchip Technology Inc.
24.9 Fractional Frequency Adjust (FFA)
FFA is a method by which PWM resolution can be
improved on 50% fixed duty cycle signals. Higher
resolution is achieved by altering the PWM period by a
single count for calculated intervals. This increased
resolution is based upon the PWM frequency
averaged over a large number of PWM periods. For
example, if the period event time is increased by one
psmc_clk period (T
PSMC_CLK) every N events, then
the effective resolution of the average event period is
T
PSMC_CLK/N.
When active, after every period event the FFA
hardware adds the PSMCxFFA value with the
previously accumulated result. Each time the addition
causes an overflow, the period event time is increased
by one. Refer to Figure 24-22.
FIGURE 24-22: FFA BLOCK DIAGRAM.
The FFA function is only available when using one of
the two Fixed Duty Cycle modes of operation. In fixed
duty cycle operation each PWM period is comprised of
two period events. That is why the PWM periods in
Table 24-3 example calculations are multiplied by two
as opposed to the normal period calculations for
normal mode operation.
The extra resolution gained by the FFA is based upon
the number of bits in the FFA register and the
psmc_clk frequency. The parameters of interest are:
•T
PWM – this is the lower bound of the PWM period
that will be adjusted
•T
PWM+1 – this is the upper bound of the PWM
period that will be adjusted. This is used to help
determine the step size for each increment of the
FFA register
•T
RESOLUTION – each increment of the FFA
register will add this amount of period to average
PWM frequency
TABLE 24-3: FRACTIONAL FREQUENCY
ADJUST CALCULATIONS
PSMCxPR<15:0>
PSMCxTMR<15:0>
Comparator
=
Period Event
PSMCxFFA<3:0>
Accumulator<3:0>
carry
psmc_clk
Parameter Value
FPSMC_CLK 64 MHz
T
PSMC_CLK 15.625 ns
PSMCxPR<15:0> 00FFh = 255
T
PWM = (PSMCxPR<15:0>+1)*2*TPSMC_CLK
= 256*2*15.625ns
= 8 us
F
PWM 125 kHz
T
PWM+1 = (PSMCxPR<15:0>+2)*2*TPSMC_CLK
= 257*2*15.625ns
= 8.03125 us
F
PWM+1 = 124.513 kHz
T
RESOLUTION = (TPWM+1-TPWM)/2
FFA-Bits
= (8.03125us - 8.0 us)/16
= 0.03125us/16
~ 1.95 ns
F
RESOLUTION (FPWM+1-FPWM)/2
FFA-Bits
~ -30.4 Hz