English
Language : 

PIC18F87K22 Datasheet, PDF (249/548 Pages) Microchip Technology – 64/80-Pin, High-Performance, 1-Mbit Enhanced Flash Microcontrollers with 12-Bit A/D and nanoWatt XLP Technology
PIC18F87K22 FAMILY
FIGURE 19-1:
CAPTURE MODE OPERATION BLOCK DIAGRAM
CCP5 Pin
Prescaler
 1, 4, 16
Set CCP5IF
C5TSEL0
and
Edge Detect
C5TSEL0
CCP5CON<3:0> 4
Q1:Q4 4
CCP4CON<3:0> 4
Set CCP4IF
C4TSEL1
C4TSEL0
CCP4 Pin
Prescaler
 1, 4, 16
and
Edge Detect
C4TSEL0
C4TSEL1
TMR5H TMR5L
TMR5
Enable
CCPR5H
CCPR5L
TMR1
Enable
TMR1H
TMR1L
TMR3H
TMR3L
TMR3
Enable
CCPR4H
CCPR4L
TMR1
Enable
TMR1H
TMR1L
Note:
This block diagram uses CCP4 and CCP5, and their appropriate timers as an example. For details on all of
the CCP modules and their timer assignments, see Table 19-2 and Table 19-3.
19.2.3 SOFTWARE INTERRUPT
When the Capture mode is changed, a false capture
interrupt may be generated. The user should keep the
CCP4IE bit (PIE4<1>) clear to avoid false interrupts
and should clear the flag bit, CCP4IF, following any
such change in operating mode.
19.2.4 CCP PRESCALER
There are four prescaler settings in Capture mode.
They are specified as part of the operating mode
selected by the mode select bits (CCP4M<3:0>).
Whenever the CCP module is turned off, or the CCP
module is not in Capture mode, the prescaler counter
is cleared. This means that any Reset will clear the
prescaler counter.
Switching from one capture prescaler to another may
generate an interrupt. Doing that will also not clear the
prescaler counter – meaning the first capture may be
from a non-zero prescaler.
Example 19-1 shows the recommended method for
switching between capture prescalers. This example
also clears the prescaler counter and will not generate
the “false” interrupt.
EXAMPLE 19-1: CHANGING BETWEEN
CAPTURE PRESCALERS
CLRFCCP4CON ; Turn CCP module off
MOVLWNEW_CAPT_PS; Load WREG with the
; new prescaler mode
; value and CCP ON
MOVWFCCP4CON ; Load CCP4CON with
; this value
 2010 Microchip Technology Inc.
Preliminary
DS39960B-page 249