Datasheet.kr   

AN1250 데이터시트 PDF




Microchip에서 제조한 전자 부품 AN1250은 전자 산업 및 응용 분야에서
광범위하게 사용되는 반도체 소자입니다.


PDF 형식의 AN1250 자료 제공

부품번호 AN1250 기능
기능 Microchip CTMU
제조업체 Microchip
로고 Microchip 로고


AN1250 데이터시트 를 다운로드하여 반도체의 전기적 특성과 매개변수에 대해 알아보세요.




전체 22 페이지수

미리보기를 사용할 수 없습니다

AN1250 데이터시트, 핀배열, 회로
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




AN1250 pdf, 반도체, 판매, 대치품
AN1250
The current source of the CTMU is available in three
ranges: 0.55 μA, 5.5 μA and 55 μA. The current range
selection is made in the CTMUICON register. The cur-
rent precision for each of the three ranges is ±20%. For
many capacitive touch applications, the highest current
range setting (55 μA) works best. This allows for the
quickest charging of the capacitive touch circuit. The
CTMUICON register also has bits used to trim the
current source in ±2% increments up to ±62% for each
of the three current ranges.
The CTMU current source is enabled and disabled
using software. Two control bits, EDG1STAT and
EDG2STAT in the CTMU control register, determine if
the current source is enabled. These bits are exclu-
sively ORed. That is, if EDG1STAT and EDG2STAT are
both set or cleared, the current source is off. If either bit
is set while the other is cleared, the current source is
enabled and charging the circuit.
The IDISSEN bit is enabled to drain charge from the
A/D converter to insure the charging process begins at
zero potential. If the bit is set, the circuit is connected to
VSS (grounded). Note that the discharge of the entire
circuit is not accomplished with this feature. This is
because the A/D converter is not always connected to
the external circuitry (i.e., touch sensor pad).
The CTMU Configuration register (CTMUCON) is set
up so that the external triggers are not used (these pins
may be used for general purpose I/Os). The same is
true of the CTMU pulse output pin. The CTMU current
source is configured using the CTMUICON register.
For detailed information on the CTMU registers on the
PIC24F, refer to Section 11. “Charge Time Measure-
ment Unit (CTMU)” of the “PIC24F Family Reference
Manual”.
The registers that control the CTMU on the PIC18F parts
are identical, with the exception that they are 8-bit
registers: CTMUCONH and CTMUCONL. The CTMU
also has different external trigger sources available,
namely the ECCP1 and ECCP2 Special Event Triggers.
For detailed information on the CTMU registers for
PIC18F, refer to the specific product data sheet.
See Example 1 for a typical setup of the required
CTMU and A/D converter registers. Note that the
CTMU has been configured so that the external pins
are not enabled. For the purposes of this application
note, all control of the CTMU is handled through
software. The A/D converter is set up to do manual
conversion.
For capacitive touch sensing, a relative change in
capacitance due to the presence of a finger is required.
The absolute measurement of capacitance is not
required.
Note:
All PIC18F code examples are written for
the PIC18F46J11 family. For other PIC18F
parts with the CTMU module, see the
device data sheet for specific CTMU
register configurations and CTMU usage.
EXAMPLE 1: CTMU AND A/D CONVERTER SETUP FOR PIC24F
//setup CTMU
//CTMUCON
CTMUCONbits.CTMUEN = 0;
CTMUCONbits.CTMUSIDL = 0;
CTMUCONbits.TGEN =
0;
CTMUCONbits.EDGEN = 0;
CTMUCONbits.EDGSEQEN = 0;
CTMUCONbits.IDISSEN = 0;
CTMUCONbits.CTTRIG = 0;
CTMUCONbits.EDG2POL = 0;
CTMUCONbits.EDG2SEL = 0x3;
CTMUCONbits.EDG1POL = 1;
CTMUCONbits.EDG1SEL = 0x3;
//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 = OC1 (don’t care)
//Edge1 Src = Timer1 (don’t care)
//CTMUICON
CTMUICON = 0x300;
CTMUICON.ITRIM = 0;
//55uA
//Nominal - No Adjustment
//setup A/D converter
AD1PCFGL = 0x0000;
AD1CON1 = 0x0000;
AD1CHS = 0x0000;
AD1CSSL=0x0000;
AD1CON1bits.FORM = 0x0;
AD1CON3 = 0x0000;
AD1CON2 = 0x0000;
AD1CON1bits.ADON = 1;
CTMUCONbits.CTMUEN = 1;
//select the analog channel 0
//Unsigned fractional format
//bits.ADRC=0;
//Turn On A/D
//Enable CTMU
DS01250A-page 4
© 2009 Microchip Technology Inc.

4페이지










AN1250 전자부품, 판매, 대치품
AN1250
Example 3 provides the equivalent code for reading the
capacitive touch sensors using the CTMU on a PIC24F
device. Example 4 has the same algorithm for a
PIC18F device. Note that the channel number being
read is referenced by the Index variable. The
ADSELECT array is setup to have the correct bits set for
the corresponding Index variable so that the correct
channel is set to an analog A/D. The A/D value is
temporarily stored in the variable, immediateValue.
The LoopCount determines how long the CTMU
current source charges the capacitive touch circuit.
EXAMPLE 3: READING THE CAPACITIVE TOUCH SENSOR CIRCUIT SOFTWARE ALGORITHM
(PIC24F)
//Read CTMU (Get the raw sensor reading)
AD1PCFGL= 0xFFFF;
TRISB = 0x0000;
LATB = 0x0000;
PORTB = 0x0000;
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
//Wait for charge to drain
TRISB = ADSELECT[Index];
AD1PCFGL = ~ADSELECT[Index];
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
//wait for A/D to connect to channel
AD1CHS = Index;
CTMUCONbits.IDISSEN = 1;
Nop(); Nop(); Nop(); Nop(); Nop();
//Wait for charge to drain
CTMUCONbits.IDISSEN = 0;
IFS0bits.AD1IF
= 0;
AD1CON1bits.SAMP
= 1;
CTMUCONbits.EDG2STAT = 0;
CTMUCONbits.EDG1STAT = 1;
for (count = 0; count < loopCount; count++);
CTMUCONbits.EDG1STAT = 0;
IFS0bits.AD1IF
= 0;
AD1CON1bits.SAMP
= 0;
while(!IFS0bits.AD1IF);
immediateValue = ADC1BUF0;
AD1CON1bits.SAMP
= 0;
IFS0bits.AD1IF
= 0;
AD1CON1bits.DONE
= 0;
//End of CTMU read
//set all A/D channels to digital I/O pins
//set all channels to logical 0 outputs
//set selected channel to input
//set selected channel to analog A/D input
//select A/D channel
//Drain any charge on the A/D circuit
//Stop discharge of A/D circuit
//Make sure A/D interrupt flag = 0
//Manually start sampling
// Make sure edge2 is 0
// Set edge1 - Start Charge
// Delay for CTMU charge time
//Clear edge1 - Stop Charge
//Clear SAMP bit to begin manual A/D conversion
//Wait for the A/D conversion to finish
//Read the value from the A/D conversion
//Make sure A/D bits are cleared
© 2009 Microchip Technology Inc.
DS01250A-page 7

7페이지


구       성 총 22 페이지수
다운로드[ AN1250.PDF 데이터시트 ]

당사 플랫폼은 키워드, 제품 이름 또는 부품 번호를 사용하여 검색할 수 있는

포괄적인 데이터시트를 제공합니다.


구매 문의
일반 IC 문의 : 샘플 및 소량 구매
-----------------------------------------------------------------------

IGBT, TR 모듈, SCR 및 다이오드 모듈을 포함한
광범위한 전력 반도체를 판매합니다.

전력 반도체 전문업체

상호 : 아이지 인터내셔날

사이트 방문 :     [ 홈페이지 ]     [ 블로그 1 ]     [ 블로그 2 ]



관련 데이터시트

부품번호상세설명 및 기능제조사
AN1250

Microchip CTMU

Microchip
Microchip
AN1252

Interfacing the MRF49XA Transceiver to PIC Microcontrollers

Microchip
Microchip

DataSheet.kr       |      2020   |     연락처      |     링크모음      |      검색     |      사이트맵