Microchip Technology AC244045 Data Sheet

Page of 302
© 2009 Microchip Technology Inc.
41341E-page 131
PIC16F72X/PIC16LF72X
14.5
Software Control
The software portion of the capacitive sensing module
is required to determine the change in frequency of the
capacitive sensing oscillator. This is accomplished by
the following:
• Setting a fixed time base to acquire counts on 
Timer0 or Timer1 
• Establishing the nominal frequency for the 
capacitive sensing oscillator
• Establishing the reduced frequency for the 
capacitive sensing oscillator due to an additional 
capacitive load
• Set the frequency threshold
14.5.1
NOMINAL FREQUENCY
(NO CAPACITIVE LOAD)
To determine the nominal frequency of the capacitive
sensing oscillator:
• Remove any extra capacitive load on the selected 
CPSx pin
• At the start of the fixed time base, clear the timer 
resource
• At the end of the fixed time base save the value in 
the timer resource
The value of the timer resource is the number of
oscillations of the capacitive sensing oscillator for the
given time base. The frequency of the capacitive
sensing oscillator is equal to the number of counts on
in the timer divided by the period of the fixed time base.
14.5.2
REDUCED FREQUENCY 
(ADDITIONAL CAPACITIVE LOAD)
The extra capacitive load will cause the frequency of the
capacitive sensing oscillator to decrease. To determine
the reduced frequency of the capacitive sensing
oscillator:
• Add a typical capacitive load on the selected 
CPSx pin
• Use the same fixed time base as the nominal 
frequency measurement
• At the start of the fixed time base, clear the timer 
resource
• At the end of the fixed time base save the value in 
the timer resource
The value of the timer resource is the number of oscil-
lations of the capacitive sensing oscillator with an addi-
tional capacitive load. The frequency of the capacitive
sensing oscillator is equal to the number of counts on
in the timer divided by the period of the fixed time base.
This frequency should be less than the value obtained
during the nominal frequency measurement.
14.5.3
FREQUENCY THRESHOLD
The frequency threshold should be placed midway
between the value of nominal frequency and the
reduced frequency of the capacitive sensing oscillator.
Refer to Application Note AN1103, “Software Handling
for Capacitive Sensing
” (DS01103) for more detailed
information the software required for capacitive
sensing module.
Note:
For more information on general Capacitive
Sensing refer to Application Notes:
• AN1101, “Introduction to Capacitive 
Sensing” (DS01101)
• AN1102, “Layout and Physical Design 
Guidelines for Capacitive Sensing” 
(DS01102)