2.1.10. Capture/Compare/PWM Modules

In the PIC18F452 microcontroller, there are two Capture/Compare/PWM (CCP) modules, and they work with Timers 1, 2, and 3 to capture and compare and for PWM operations. Each module has two 8-bit registers. Module 1 registers are CCPR1L and CCPR1H, and module 2 registers are CCPR2L and CCPR2H. Together, each register pair form a 16-bit register and can be used to capture, compare, or generate waveforms with a specified duty cycle. Module 1 is controlled by register CCP1CON, and module 2 is controlled by CCP2CON. Figure 2.35 shows the bit allocations of the CCP control registers.

Figure 2.35. CCPxCON Register Bit Allocations
Capture Mode

In capture mode, the registers operate like a stopwatch, and when an ...

Get SD Card Projects Using the PIC Microcontroller now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.