Datasheet
2011-2012 Microchip Technology Inc. Preliminary DS41579D-page 261
PIC16(L)F1782/3
25.1.5 CAPTURE DURING SLEEP
Capture mode depends upon the Timer1 module for
proper operation. There are two options for driving the
Timer1 module in Capture mode. It can be driven by the
instruction clock (F
OSC/4), or by an external clock source.
When Timer1 is clocked by F
OSC/4, Timer1 will not
increment during Sleep. When the device wakes from
Sleep, Timer1 will continue from its previous state.
Capture mode will operate during Sleep when Timer1
is clocked by an external clock source.
25.1.6 ALTERNATE PIN LOCATIONS
This module incorporates I/O pins that can be moved to
other locations with the use of the alternate pin function
register APFCON. To determine which pins can be
moved and what their default locations are upon a
Reset, see
Section 13.1 “Alternate Pin Function” for
more information.
25.2 Compare Mode
The Compare mode function described in this section
is available and identical for al CCP modules.
Compare mode makes use of the 16-bit Timer1
resource. The 16-bit value of the CCPRxH:CCPRxL
register pair is constantly compared against the 16-bit
value of the TMR1H:TMR1L register pair. When a
match occurs, one of the following events can occur:
• Toggle the CCPx output
• Set the CCPx output
• Clear the CCPx output
• Generate an Auto-conversion Trigger
• Generate a Software Interrupt
The action on the pin is based on the value of the
CCPxM<3:0> control bits of the CCPxCON register. At
the same time, the interrupt flag CCPxIF bit is set.
All Compare modes can generate an interrupt.
Figure 25-2 shows a simplified diagram of the compare
operation.
FIGURE 25-2: COMPARE MODE
OPERATION BLOCK
DIAGRAM
25.2.1 CCPX PIN CONFIGURATION
The user must configure the CCPx pin as an output by
clearing the associated TRIS bit.
The CCP2 pin function can be moved to alternate pins
using the APFCON register (Register 13-1). Refer to
Section 13.1 “Alternate Pin Function” for more
details.
25.2.2 TIMER1 MODE RESOURCE
In Compare mode, Timer1 must be running in either
Timer mode or Synchronized Counter mode. The
compare operation may not work in Asynchronous
Counter mode.
See
Section 22.0 “Timer1 Module with Gate Control”
for more information on configuring Timer1.
25.2.3 SOFTWARE INTERRUPT MODE
When Generate Software Interrupt mode is chosen
(CCPxM<3:0> = 1010), the CCPx module does not
assert control of the CCPx pin (see the CCPxCON
register).
Note: Clearing the CCPxCON register will force
the CCPx compare output latch to the
default low level. This is not the PORT I/O
data latch.
Note: Clocking Timer1 from the system clock
(F
OSC) should not be used in Compare
mode. In order for Compare mode to
recognize the trigger event on the CCPx
pin, TImer1 must be clocked from the
instruction clock (F
OSC/4) or from an
external clock source.
CCPRxH CCPRxL
TMR1H TMR1L
Comparator
QS
R
Output
Logic
Auto-conversion Trigger
Set CCPxIF Interrupt Flag
(PIRx)
Match
TRIS
CCPxM<3:0>
Mode Select
Output Enable
Pin
CCPx
4