You are on page 1of 20

CCP Module

• Compare/Capture/Pulse Width Modulation.


• Depending on the family, PIC can have 0 to 5
CCP modules designated as CCPx, where x is
the CCP module number.
• In recent years, the PWM features of CCP are
enhanced for better DC motor control, hence
Enhanced CCP modules (ECCPs) are also
available.
• PIC18F452 has 1CCP and 1 ECCP module.
• To program CCPs, one should have a better
knowledge about PIC18 Timer.
• The allocation of timers among the CCP
features are shown as

• The T3CON register is used to choose the


timer for the compare and capture modes.
CCP registers
• Each CCP module has 3 registers associated
with it :
• CCPxCON
– 8 bit control register.
– We select one of the compare, capture and PWM
modes using this register.
• CCPRxL and CCPRxH form the Low byte and High
byte of the 16 bit register.
• This 16 bit register can be used as a 16 bit compare
register, 16 bit capture register or a 8 bit duty cycle
register by the PWM, but not all at the same time.
CCP1 Control Register
• CCP pins
Compare mode programming
• The compare mode of the CCP module is selected using the select bits in the
CCPxCON register. The Compare mode can cause an event outside the
microcontroller.

• Note that upon match, CCP1IF of the Peripheral Interrupt Flag Register will go
HIGH.
Compare mode Operation
Capture mode Programming
Capture Mode Operation
PWM Programming
ECCP Pins

You might also like