English
Language : 

PIC18F87K90 Datasheet, PDF (241/566 Pages) Microchip Technology – 64/80-Pin, High-Performance Microcontrollers with LCD Driver and nanoWatt XLP Technology
PIC18F87K90 FAMILY
FIGURE 18-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 18-2 and Table 18-3.
18.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.
18.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 also will not clear the
prescaler counter – meaning the first capture may be
from a non-zero prescaler.
Example 18-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 18-1: CHANGING BETWEEN
CAPTURE PRESCALERS
CLRF CCP4CON
MOVLW NEW_CAPT_PS
MOVWF CCP4CON
; Turn CCP module off
; Load WREG with the
; new prescaler mode
; value and CCP ON
; Load CCP4CON with
; this value
 2010 Microchip Technology Inc.
Preliminary
DS39957B-page 241