23.5 PWM Resolution

The resolution determines the number of available duty cycles for a given period. For example, a 10-bit resolution will result in 1024 discrete duty cycles, whereas an 8-bit resolution will result in 256 discrete duty cycles. The maximum PWM resolution is ten bits when T2PR is 255. The resolution is a function of the T2PR register value, as shown below.

Equation 23-4. PWM Resolution
Resolution=log[4(T2PR+1)]log(2)bits
Important: If the pulse-width value is greater than the period, the assigned PWM pin(s) will remain unchanged.
Table 23-1. Example PWM Frequencies and Resolutions (FOSC = 20 MHz)
PWM Frequency0.31 kHz4.88 kHz19.53 kHz78.12 kHz156.3 kHz208.3 kHz
Timer Prescale6441111
T2PR Value0xFF0xFF0xFF0x3F0x1F0x17
Maximum Resolution (bits)101010876.6
Table 23-2. Example PWM Frequencies and Resolutions (FOSC = 8 MHz)
PWM Frequency0.31 kHz4.90 kHz19.61 kHz76.92 kHz153.85 kHz200.0 kHz
Timer Prescale6441111
T2PR Value0x650x650x650x190x0C0x09
Maximum Resolution (bits)888655