PIC16F1827-E/P Microchip Technology Inc., PIC16F1827-E/P Datasheet - Page 316

no-image

PIC16F1827-E/P

Manufacturer Part Number
PIC16F1827-E/P
Description
7 KB Flash, 384 bytes RAM, 32 MHz Int. Osc, 16 I/0, Enhanced Mid Range Core
Manufacturer
Microchip Technology Inc.
Datasheet

Specifications of PIC16F1827-E/P

A/d Inputs
12-Channel, 10-Bit
Comparators
2
Cpu Speed
8 MIPS
Eeprom Memory
256 Bytes
Input Output
16
Interface
CAN/I2C/SPI/UART/USART
Memory Type
Flash
Number Of Bits
8
Package Type
18-pin PDIP
Programmable Memory
7K Bytes
Ram Size
384 Bytes
Speed
32 MHz
Timers
4-8-bit, 1-16-bit
Voltage, Range
1.8-5.5 V
Standby Current (pic16lf182x)
30 nA @ 1.8 V, Typical
PIC16(L)F1826/27
27.1
The capacitive sensing module can monitor up to 12
inputs. The capacitive sensing inputs are defined as
CPS<11:0>. To determine if a frequency change has
occurred the user must:
• Select the appropriate CPS pin by setting the
• 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
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
• Maximize the count differential in the timer during
27.3
To measure the change in frequency of the capacitive
sensing oscillator, a fixed time base is required. For the
period of the fixed time base, the capacitive sensing
oscillator is used to clock either Timer0 or Timer1. The
frequency of the capacitive sensing oscillator is equal
to the number of counts in the timer divided by the
period of the fixed time base.
27.4
To measure the frequency of the capacitive sensing
oscillator, a fixed time base is required. Any timer
resource or software loop can be used to establish the
fixed time base. It is up to the end user to determine the
method in which the fixed time base is generated.
DS41391D-page 316
CPSCH<3:0> bits of the CPSCON1 register
fixed time base
a change in frequency
Note:
Analog MUX
Capacitive Sensing Oscillator
Timer resources
Fixed Time Base
The fixed time base can not be generated
by the timer resource that the capacitive
sensing oscillator is clocking.
27.4.1
To select Timer0 as the timer resource for the capacitive
sensing module:
• Set the T0XCS bit of the CPSCON0 register
• Clear the TMR0CS bit of the OPTION register
When Timer0 is chosen as the timer resource, the
capacitive sensing oscillator will be the clock source for
Timer0. Refer to
additional information.
27.4.2
To select Timer1 as the timer resource for the
capacitive sensing module, set the TMR1CS<1:0> of
the T1CON register to ‘11’. When Timer1 is chosen as
the timer resource, the capacitive sensing oscillator will
be the clock source for Timer1. Because the Timer1
module has a gate control, developing a time base for
the frequency measurement can be simplified by using
the Timer0 overflow flag.
It is recommend that the Timer0 overflow flag, in con-
junction with the Toggle mode of the Timer1 gate, be
used to develop the fixed time base required by the
software portion of the capacitive sensing module.
Refer to
for additional information.
TABLE 27-1:
TMR1ON
0
0
1
1
Section 21.6.3 “Timer1 Gate Toggle Mode”
TIMER0
TIMER1
TMR1GE
Section 20.0 “Timer0 Module”
TIMER1 ENABLE FUNCTION
0
1
0
1
 2011 Microchip Technology Inc.
Count Enabled by input
Timer1 Operation
Off
Off
On
for

Related parts for PIC16F1827-E/P