Microchip Technology AC244045 Data Sheet

Page of 302
PIC16F72X/PIC16LF72X
41341E-page 132
© 2009 Microchip Technology Inc.
14.6
Operation during Sleep
The capacitive sensing oscillator will continue to run as
long as the module is enabled, independent of the part
being in Sleep. In order for the software to determine if
a frequency change has occurred, the part must be
awake. However, the part does not have to be awake
when the timer resource is acquiring counts. One way
to acquire the Timer1 counts while in Sleep is to have
Timer1 gated with the overflow of the Watchdog Timer.
This can be accomplished using the following steps:
1.
Configure the Watchdog Time-out overflow as
the Timer1’s gate source T1GSS<1:0> = 11.
2.
Set Timer1 Gate to toggle mode by setting the
T1GTM bit of the T1GCON register.
3.
Set the TMR1GE bit of the T1GCON register.
4.
Set TMR1ON bit of the T1CON register.
5.
Enable capacitive sensing module with the
appropriate current settings and pin selection.
6.
Clear Timer1.
7.
Put the part to Sleep.
8.
On the first WDT overflow, the capacitive sens-
ing oscillator will begin to increment Timer1.
Then put the part to Sleep.
9.
On the second WDT overflow Timer1 will stop
incrementing. Then run the software routine to
determine if a frequency change has occurred.
Refer to Section 12.0 “Timer1 Module with Gate
Control”
 for additional information.
Note 1: When using the WDT to set the interval
on Timer1, any other source that wakes
the part up early will cause the WDT over-
flow to be delayed, affecting the value
captured by Timer1.
2: Timer0 does not operate when in Sleep,
and therefore cannot be used for
capacitive sense measurements in Sleep.