English
Language : 

PIC18F23K22 Datasheet, PDF (186/492 Pages) Microchip Technology – 28/40/44-Pin, Low-Power, High-Performance Microcontrollers with nanoWatt XLP Technology
PIC18(L)F2X/4XK22
14.3.6 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 10 bits when PRx is
255. The resolution is a function of the PRx register
value as shown by Equation 14-4.
EQUATION 14-4: PWM RESOLUTION
Resolution = l--o---g------4---l-o--P-g---R---2-x----+------1------ bits
Note:
If the pulse width value is greater than the
period the assigned PWM pin(s) will
remain unchanged.
TABLE 14-7: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS (FOSC = 32 MHz)
PWM Frequency
1.95 kHz
7.81 kHz 31.25 kHz 125 kHz
250 kHz
Timer Prescale (1, 4, 16)
PRx Value
16
0xFF
4
0xFF
1
0xFF
1
0x3F
1
0x1F
Maximum Resolution (bits)
10
10
10
8
7
333.3 kHz
1
0x17
6.6
TABLE 14-8: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS (FOSC = 20 MHz)
PWM Frequency
1.22 kHz 4.88 kHz 19.53 kHz 78.12 kHz 156.3 kHz
Timer Prescale (1, 4, 16)
PRx Value
Maximum Resolution (bits)
16
0xFF
10
4
0xFF
10
1
0xFF
10
1
0x3F
8
1
0x1F
7
208.3 kHz
1
0x17
6.6
TABLE 14-9: EXAMPLE PWM FREQUENCIES AND RESOLUTIONS (FOSC = 8 MHz)
PWM Frequency
1.22 kHz 4.90 kHz 19.61 kHz 76.92 kHz 153.85 kHz
Timer Prescale (1, 4, 16)
PRx Value
Maximum Resolution (bits)
16
0x65
8
4
0x65
8
1
0x65
8
1
0x19
6
1
0x0C
5
200.0 kHz
1
0x09
5
14.3.7 OPERATION IN SLEEP MODE
In Sleep mode, the TMRx register will not increment
and the state of the module will not change. If the CCPx
pin is driving a value, it will continue to drive that value.
When the device wakes up, TMRx will continue from its
previous state.
14.3.9 EFFECTS OF RESET
Any Reset will force all ports to Input mode and the
CCP registers to their Reset states.
14.3.8 CHANGES IN SYSTEM CLOCK
FREQUENCY
The PWM frequency is derived from the system clock
frequency. Any changes in the system clock frequency
will result in changes to the PWM frequency. See
Section 2.0 “Oscillator Module (With Fail-Safe
Clock Monitor)” for additional details.
DS41412B-page 186
Preliminary
 2010 Microchip Technology Inc.