DataSheet.es    


PDF AN1250 Data sheet ( Hoja de datos )

Número de pieza AN1250
Descripción Microchip CTMU
Fabricantes Microchip 
Logotipo Microchip Logotipo



Hay una vista previa y un enlace de descarga de AN1250 (archivo pdf) en la parte inferior de esta página.


Total 22 Páginas

No Preview Available ! AN1250 Hoja de datos, Descripción, Manual

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

1 page




AN1250 pdf
AN1250
EXAMPLE 2: CTMU AND A/D CONVERTER SETUP FOR PIC18F
//setup CTMU
//CTMUCON
CTMUCONHbits.CTMUEN = 0;
CTMUCONHbits.CTMUSIDL = 0;
CTMUCONHbits.TGEN = 0;
CTMUCONHbits.EDGEN = 0;
CTMUCONHbits.EDGSEQEN = 0;
CTMUCONHbits.IDISSEN = 0;
CTMUCONHbits.CTTRIG = 0;
CTMUCONLbits.EDG2POL = 0;
CTMUCONLbits.EDG2SEL = 0x0;
CTMUCONLbits.EDG1POL = 1;
CTMUCONLbits.EDG1SEL = 0x1;
//CTMUICON
CTMUICON = 0x03;
CTMUICON.ITRIM = 0;
//setup A/D converter
ANCON0bits.PCFG = 0x00;
ANCON1 = 0x0000;
ADCON0bits.CHS = 0x00;
ADCON1bits.ADFM = 0x00;
ADCON1bits.ADON = 1;
CTMUCONHbits.CTMUEN = 1;
//make sure CTMU is disabled
//CTMU continues to run in idle mode
//disable edge delay generation mode of the CTMU
//edges are blocked
//edge sequence not needed
//Do not ground the current source
//Trigger Output is disabled
//Edge2 Src = ECCP2 (don’t care)
//Edge1 Src = ECCP1 pin (don’t care)
//55uA
//Nominal - No Adjustment
//select the analog channel 0
//right justified result
//Turn On A/D
//Enable CTMU
In the case of the PIDEM Touch Sense 2 Demo Board,
all 16 A/D channels are used for capacitive touch. Read-
ing of each of the sensor channels (A/D channels) is
controlled by Timer1. Timer1 is setup to fire at a 1 ms
interval. Each time that the Timer1 interrupt handler
runs, it increments the channel number of the A/D and
the capacitive sensor connected to that channel is read.
After all 16 touch sensors have been read, the Timer1
interrupt handler sets a flag called, “dataReadyCTMU”,
and the main routine uses this flag to know when to
process the new data just gathered from all 16 capacitive
touch sensors.
© 2009 Microchip Technology Inc.
DS01250A-page 5

5 Page





AN1250 arduino
Paired Keys Press
The paired keys press is similar to the multiple key
press with the exception that all of the combinations of
one half (1/2) are used. In Figure 5, it can be seen that
each button is made up of either a full circle single
touch pad, or two half (1/2) circle touch pads. The soft-
ware for the paired press is similar to that used for the
multiple key press described above. The “half” pressed
keys are looked for first, and then single keys are
scanned for if no paired press keys are found. This
implementation has the distinction of generating
10 keys from only four capacitive touch sensor inputs.
It should be noted that it is somewhat difficult to
differentiate between two single keys being pressed
and a single paired press key.
FIGURE 5:
PAIRED KEY PRESS
CAPACITIVE TOUCH
SENSOR KEYS
CTMU Channel: 1
2
3
4
AN1250
Matrix Keys Implementation
Matrix keys use a set of capacitive touch sensors
arranged in rows and columns to provide a maximum
number of buttons or keys with respect to the number of
capacitive touch sensor inputs. The PICDEM Touch
Sense 2 Demo Board makes use of a matrix of four rows
by five columns (4 x 5) to implement a 20-key calculator
type keypad. Notice that the number of channels (9)
yields a total of 20 distinct keys. The number of possible
keys is the multiplication of the number of rows and
columns (4 x 5), while the number of channels required
is the sum of the number of rows plus the number of
columns (4 + 5). Appendix A: “PICDEM™ Touch
Sense 2 Demo Board” depicts the PICDEM Touch
Sense 2 Demo Board with the cover plate removed. The
keypad matrix is in the center of the board. Each key is
a unique combination of a row and a column of the
matrix. Each key is made up of two touch sensors
shaped as half circles, one half circle for the row and one
half circle for the column. See Figure 6 for a visual
example of a keypad matrix. The software algorithm for
the keypad matrix looks for a row pressed and a column
pressed, and decodes the key pressed. The software for
this implementation also looks for the most pressed row
and column. This is done since the proximity of the sen-
sors can sometimes cause adjacent rows or columns to
cross the tripped threshold level. It is important to note
that using matrix keys causes the overall capacitance to
increase. For example, a matrix with four (4) rows will
have approximately two (2) times the capacitance of a
single sensor key of equal size. This factor becomes
important, since the software is looking for the relative
change in capacitance due to a finger on the capacitive
touch sensor key. Another key factor is that since the
rows and columns are very close to each of the actual
keys, capacitive coupling also increases the amount of
capacitance seen by each of the sensor inputs.
It is important to keep the capacitances for each of the
rows and each of the columns matched as closely as
possible, especially when considering that the software
algorithm is searching for the “most pressed” row and
column. The trace lengths to each row/column and
adjacent sensors, LEDs and other board traces
become important. The CTMU current trimming capa-
bility, mentioned in the “Multiple Keys Press” section,
is applicable to the matrix keypad as well.
The difference between paired press and matrix keys is
that for the matrix, there is a key for each combination
of row and column, and for the paired press, there is a
key assigned to each capacitive touch channel and a
key assigned to each combination of two capacitive
touch channels.
© 2009 Microchip Technology Inc.
DS01250A-page 11

11 Page







PáginasTotal 22 Páginas
PDF Descargar[ Datasheet AN1250.PDF ]




Hoja de datos destacado

Número de piezaDescripciónFabricantes
AN1250Microchip CTMUMicrochip
Microchip
AN1252Interfacing the MRF49XA Transceiver to PIC MicrocontrollersMicrochip
Microchip

Número de piezaDescripciónFabricantes
SLA6805M

High Voltage 3 phase Motor Driver IC.

Sanken
Sanken
SDC1742

12- and 14-Bit Hybrid Synchro / Resolver-to-Digital Converters.

Analog Devices
Analog Devices


DataSheet.es es una pagina web que funciona como un repositorio de manuales o hoja de datos de muchos de los productos más populares,
permitiéndote verlos en linea o descargarlos en PDF.


DataSheet.es    |   2020   |  Privacy Policy  |  Contacto  |  Buscar