English
Language : 

AN1250 Datasheet, PDF (1/22 Pages) Microchip Technology – Microchip CTMU for Capacitive Touch Applications
AN1250
Microchip CTMU for Capacitive Touch Applications
Author: Bruce Bohn
Microchip Technology Inc.
INTRODUCTION
This application note describes the use of Microchip’s
Charge Time Measurement Unit (CTMU) for capacitive
touch applications. The CTMU is an excellent periph-
eral for use in touch sensing applications. The following
are some of the benefits of using the CTMU for touch
sensing applications:
• Easy hardware setup
• Simple to use software algorithms, available free
of charge
• High speed allows for greater scan rate of
capacitive touch switches and for many other
processor tasks
• Low cost and low component count; no external
hardware other than a connection to the copper
sensor pad
The purpose of this application note is to inform
prospective users of the CTMU for capacitive touch on
general usage guidelines, CTMU setup and software
algorithms, hardware and layout considerations, and
advanced capacitive touch applications, such as matrix
keys, sliders and multiple press keys.
The CTMU is currently available on selected PIC24
and PIC18F parts. Wherever possible, sample code for
both has been included.
All hardware examples used in this application note
directly pertain to the PICDEM™ Touch Sense 2
Demonstration Board (Part Number DM164128). The
PICDEM Touch Sense 2 Demo Board uses a PIC24F
device-based microcontroller (PIC24FJ256GB110).
This demo board is not necessary for understanding this
application note.
GENERAL FEATURES OF THE CTMU
The CTMU is made up of a constant current source and
several logic blocks for it to operate:
• The constant current source is connected to the
A/D converter of the microcontroller.
• A switch connected to the CTMU constant current
source (and the A/D converter) is provided to
allow accumulated charge to be drained.
• Two external pins are provided to trigger the
constant current source.
• An output pin is also available for CTMU use.
For the purposes of capacitive touch, the external
pins for triggering the CTMU and the CTMU output
pin are not used.
The connection of the CTMU to the A/D converter is all
that is needed for capacitive touch applications. For a
more in-depth discussion on the CTMU module and
how it is used to measure charge or time, refer to the
CTMU chapter of the “PIC24F Family Reference Man-
ual” for PIC24F microcontrollers, or the appropriate
data sheet for PIC18F microcontrollers on the
Microchip web site (http://www.microchip.com).
See Figure 1 for a block diagram of the CTMU hardware.
Note that there are a few slight differences in the CTMU
module from the PIC18F and the PIC24F. The PIC18F
CTMU module does not have an automatic ADC
conversion trigger. This is of no consequence for
capacitive touch applications. For clarity, the automatic
ADC trigger present on the PIC24F has not been used
in the sample code so that it more closely matches the
PIC18F code.
Also note that the CTMU on the PIC18F has different
internal trigger sources. (ECCP1 and ECCP2 for
PIC18F and Timer1 and OC1 for PIC24F). This is
mentioned purely for reference, and again, makes no
difference for capacitive touch applications. The sample
code listings in this application note manually set/clear
the EDG1STAT1 and/or EDG2STAT bits in the CTMU
control register for starting and stopping the CTMU
current source.
© 2009 Microchip Technology Inc.
DS01250A-page 1