Specifications

mikroElektronika | Free Online Book | PIC Microcontrollers | Chapter 5: CCP Modules
TOC
Introduction
Ch. 1
Ch. 2
Ch. 3
Ch. 4
Ch. 5
Ch. 6
Ch. 7
Ch. 8
Ch. 9
App. A
App. B
App. C
Chapter 5: CCP Modules
The abbreviation CCP stands for Capture/Compare/PWM.
The CCP module is a peripheral which allows the user to time and control different events.
Capture Mode, allows timing for the duration of an event. This circuit gives insight into the current state of a register
which constantly changes its value. In this case, it is the timer TMR1 register.
Compare Mode compares values contained in two registers at some point. One of them is the timer TMR1 register. This
circuit also allows the user to trigger an external event when a predetermined amount of time has expired.
PWM - Pulse Width Modulation can generate signals of varying frequency and duty cycle.
The PIC16F887 microcontroller has two such modules - CCP1 and CCP2.
Both of them are identical in normal mode, with the exception of the Enhanced PWM features available on CCP1 only. This
is why this chapter describes the CCP1 module in detail. Concerning CCP2, only the features distinguishing it from CCP1
will be covered.
Complicated? All this is only a simplified explanation on their operation. Everything is much more complicated in
practice because these modules can operate in many different modes. Try to analyze their operation on the basis of the
tables describing bit functions. If you use any CCP module, first select the mode you need, analyze the appropriate
figure and then start changing bits of the registers or else...
CCP1 Module
A central part of this circuit is a 16-bit register CCPR1, which consists of the CCPR1L and CCPR1H registers. It is used for
capturing or comparing with binary number stored in the timer register TMR1 (TMR1H and TMR1L).
http://www.mikroe.com/en/books/picmcubook/ch5/ (1 of 15)5/3/2009 11:33:21 AM