PIC12F/LF1822/16F/LF1823
23.4 PWM (Enhanced Mode)
The enhanced PWM mode generates a Pulse-Width
Modulation (PWM) signal on up to four different output
pins with up to 10 bits of resolution. The period, duty
cycle, and resolution are controlled by the following
registers:
• PR2 registers
• T2CON registers
• CCPR1L registers
• CCP1CON registers
The ECCP modules have the following additional PWM
registers which control Auto-shutdown, Auto-restart,
Dead-band Delay and PWM Steering modes:
• CCP1AS registers
• PSTR1CON registers
• PWM1CON registers
The enhanced PWM module can generate the following
four PWM Output modes:
• Single PWM
• Half-Bridge PWM
• Full-Bridge PWM (PIC16F/LF1823 only)
• Single PWM with PWM Steering Mode
To select an Enhanced PWM Output mode, the P1M bits
of the CCP1CON register must be configured
appropriately.
The PWM outputs are multiplexed with I/O pins and are
designated P1A, P1B, P1C and P1D. The polarity of the
PWM pins is configurable and is selected by setting the
bits CCP1M<3:0> in the CCP1CON register
appropriately.
Figure 23-5 shows an example of a simplified block
diagram of the Enhanced PWM module.
Table 23-8 shows the pin assignments for various
Enhanced PWM modes.
Note 1: The corresponding TRIS bit must be
cleared to enable the PWM output on the
CCP1 pin.
2: Clearing the CCP1CON register will
relinquish control of the CCP1 pin.
3: Any pin not used in the enhanced PWM
mode is available for alternate pin
functions, if applicable.
4: To prevent the generation of an
incomplete waveform when the PWM is
first enabled, the ECCP module waits
until the start of a new PWM period before
generating a PWM signal.
FIGURE 23-5:
EXAMPLE SIMPLIFIED BLOCK DIAGRAM OF THE ENHANCED PWM MODE
Duty Cycle Registers
CCPR1L
DC1B<1:0>
CCPR1H (Slave)
Comparator
R
TMR2
(1)
S
Comparator
PR2
Clear Timer,
toggle PWM pin and
latch duty cycle
P1M<1:0>
CCP1M<3:0>
2
4
CCP1/P1A
TRISx
P1B
Q
Output
Controller
TRISx
P1C(2)
TRISx
P1D(2)
TRISx
PWM1CON
CCP1/P1A
P1B
P1C(2)
P1D(2)
Note 1:
2:
The 8-bit timer TMR1 register is concatenated with the 2-bit internal Q clock, or 2 bits of the prescaler to create the 10-bit time
base.
PIC16F/LF1823 only.
DS41413A-page 208
Preliminary
2010 Microchip Technology Inc.