Modalities of Using the PIC 16F877A CCP Module Compare Section
The CCP module is one of the most important modules in the PIC microcontroller. While being extremely important, it is not very difficult to use. Here I will show you how to use the compare section of the CCP (Compare, Capture, Pulse Width Modulation) module of the PIC16F877A. You can use this concept for any PIC with a CCP/ECCP module There are 2 modules associated with the compare section – the CCP module which we’ll use for the compare function, and the Timer 1 module. The function of the compare module is to compare (obviously, as the name suggests) the value of the CCPR1 register against the Timer 1 value. The CCPR1 register is actually composed of two 8-bit registers that together form a 16-bit register. The high 8-bits – the high byte – make up the CCPR1H register and the low 8-bits – the low byte – make up the CCPR1L register. For example, if the value of CCPR1H is 30 and the value of CCPR1L is 47, what is the value of the 16-bit CCPR1 register? Solution: CCPR1H = 30 = 0x1E CC...