Microchip Technology AC244045 Data Sheet

Page of 448
 2010-2012 Microchip Technology Inc.
DS41440C-page 323
PIC16(L)F1825/1829
27.1
Analog MUX
The CPS module can monitor up to four inputs for the
PIC16(L)F1825 (CPSCH<7:0>) and up to eight inputs
for the PIC16(L)F1829 (CPSCH<11:0>). See
 for details. The capacitive sensing inputs
are defined as CPS<11:0>, as applicable to device. To
determine if a frequency change has occurred the user
must:
• Select the appropriate CPS pin by setting the 
CPSCH<3:0> bits of the CPSCON1 register.
• Set the corresponding ANSEL bit.
• Set the corresponding TRIS bit.
• Run the software algorithm.
The CPS module can monitor up to four inputs for the
PIC16(L)F1825 (CPSCH<7:0>) and up to eight inputs
for the PIC16(L)F1829 (CPSCH<11:0>). See
 for details. The capacitive sensing inputs
are defined as CPS<11:0>, as applicable to device. To
determine if a frequency change has occurred the user
must:
• Select the appropriate CPS pin by setting the 
appropriate CPSCH bits of the CPSCON1 register.
• Set the corresponding ANSEL bit.
• Set the corresponding TRIS bit.
• Run the software algorithm.
Selection of the CPSx pin while the module is enabled
will cause the capacitive sensing oscillator to be on the
CPSx pin. Failure to set the corresponding ANSEL and
TRIS bits can cause the capacitive sensing oscillator to
stop, leading to false frequency readings.
27.2
Capacitive Sensing Oscillator
The capacitive sensing oscillator consists of a constant
current source and a constant current sink, to produce
a triangle waveform. The CPSOUT bit of the
CPSCON0 register shows the status of the capacitive
sensing oscillator, whether it is a sinking or sourcing
current. The oscillator is designed to drive a capacitive
load (single PCB pad) and at the same time, be a clock
source to either Timer0 or Timer1. The oscillator has
three different current settings as defined by
CPSRNG<1:0> of the CPSCON0 register. The different
current settings for the oscillator serve two purposes: 
• Maximize the number of counts in a timer for a 
fixed time base.
• Maximize the count differential in the timer during 
a change in frequency.
27.3
Voltage References
The capacitive sensing oscillator uses voltage
references to provide two voltage thresholds for
oscillation. The upper voltage threshold is referred to
as Ref+ and the lower voltage threshold is referred to
as Ref-.
The user can elect to use Fixed Voltage References,
which are internal to the capacitive sensing oscillator,
or variable voltage references, which are supplied by
the Fixed Voltage Reference (FVR) module and the
Digital-to-Analog Converter (DAC) module.
When the Fixed Voltage References are used, the V
SS
voltage determines the lower threshold level (Ref-) and
the V
DD
 voltage determines the upper threshold level
(Ref+).
When the variable voltage references are used, the
DAC voltage determines the lower threshold level
(Ref-) and the FVR voltage determines the upper
threshold level (Ref+). An advantage of using these
reference sources is that oscillation frequency remains
constant with changes in V
DD
.
Different oscillation frequencies can be obtained
through the use of these variable voltage references.
The more the upper voltage reference level is lowered
and the more the lower voltage reference level is
raised, the higher the capacitive sensing oscillator
frequency becomes.
Selection between the voltage references is controlled
by the CPSRM bit of the CPSCON0 register. Setting
this bit selects the variable voltage references and
clearing this bit selects the Fixed Voltage References.
Please see 
 an
 for more information on configuring the
variable voltage levels.