27.4.4 PWM Period

The PWM period is specified by the T2PR register of Timer2. The PWM period can be calculated using the formula in the equation below.

Equation 27-1. PWM Period
P W M P e r i o d = [ ( T 2 P R + 1 ) ] 4 T O S C ( T M R 2 Pr e s c a l e V a l u e )

where TOSC = 1/FOSC

When T2TMR is equal to T2PR, the following three events occur on the next increment event:

  • T2TMR is cleared
  • The CCPx pin is set (Exception: If the PWM duty cycle = 0%, the pin will not be set)
  • The PWM duty cycle is transferred from the CCPRx register into a 10-bit buffer
Important: The Timer postscaler (see the “Timer2 Interrupt” section in the “TMR2 - Timer2 Module” chapter) is not used in the determination of the PWM frequency.