Professional Documents
Culture Documents
14 B Capture/Compare/Pwm (CCP) Modules in Pic
14 B Capture/Compare/Pwm (CCP) Modules in Pic
14 B Capture/Compare/Pwm (CCP) Modules in Pic
The CCP1 and CCP2 modules are identical in its operation except in its special event trigger
operation. In each CCP modules, the capture, compare and PWM modes using different timer
resources. The table below shows the different CCP modes and its timer resources. The detailed
explanations and functions of CCP module is given below.
CCP1 Module
Capture Mode
In Capture mode, CCPR1H:CCPR1L captures the 16-bit value of the TMR1 register when an
event occurs on pin RC2/CCP1.
Compare Mode
In Compare mode, the 16-bit CCPR1 register value is constantly compared against the TMR1
register pair value. When a match occurs, the RC2/CCP1 pin is:
Driven high
• Driven low
• Remains unchanged
The action on the pin is based on the value of control bits, CCP1M3:CCP1M0
(CCP1CON<3:0>). At the same time, interrupt flag bit CCP1IF is set. The compare mode block
diagram is shown below.
PWM Mode (PWM)
In Pulse Width Modulation mode, the CCPx pin produces up to a 10-bit resolution PWM output.
Since the CCP1 pin is multiplexed with the PORTC data latch, the TRISC<2> bit must be
cleared to make the CCP1 pin an output. Figure shows a simplified block diagram of the CCP
module in PWM mode.