Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN1250 Datasheet(PDF) 7 Page - Microchip Technology

Part # AN1250
Description  Microchip CTMU for Capacitive Touch Applications
PDF  22 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MICROCHIP [Microchip Technology]
Direct Link  http://www.microchip.com
Logo MICROCHIP - Microchip Technology

AN1250 Datasheet(HTML) 7 Page - Microchip Technology

Back Button AN1250 Datasheet HTML 3Page - Microchip Technology AN1250 Datasheet HTML 4Page - Microchip Technology AN1250 Datasheet HTML 5Page - Microchip Technology AN1250 Datasheet HTML 6Page - Microchip Technology AN1250 Datasheet HTML 7Page - Microchip Technology AN1250 Datasheet HTML 8Page - Microchip Technology AN1250 Datasheet HTML 9Page - Microchip Technology AN1250 Datasheet HTML 10Page - Microchip Technology AN1250 Datasheet HTML 11Page - Microchip Technology Next Button
Zoom Inzoom in Zoom Outzoom out
 7 / 22 page
background image
© 2009 Microchip Technology Inc.
DS01250A-page 7
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;
//set all A/D channels to digital I/O pins
TRISB = 0x0000;
LATB
= 0x0000;
PORTB = 0x0000;
//set all channels to logical 0 outputs
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
//Wait for charge to drain
TRISB = ADSELECT[Index];
//set selected channel to input
AD1PCFGL = ~ADSELECT[Index];
//set selected channel to analog A/D input
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
//wait for A/D to connect to channel
AD1CHS = Index;
//select A/D channel
CTMUCONbits.IDISSEN
= 1;
//Drain any charge on the A/D circuit
Nop(); Nop(); Nop(); Nop(); Nop();
//Wait for charge to drain
CTMUCONbits.IDISSEN = 0;
//Stop discharge of A/D circuit
IFS0bits.AD1IF
= 0;
//Make sure A/D interrupt flag = 0
AD1CON1bits.SAMP
= 1;
//Manually start sampling
CTMUCONbits.EDG2STAT
= 0;
// Make sure edge2 is 0
CTMUCONbits.EDG1STAT
= 1;
// Set edge1 - Start Charge
for (count = 0; count < loopCount; count++);
// Delay for CTMU charge time
CTMUCONbits.EDG1STAT
= 0;
//Clear edge1 - Stop Charge
IFS0bits.AD1IF
= 0;
AD1CON1bits.SAMP
= 0;
//Clear SAMP bit to begin manual A/D conversion
while(!IFS0bits.AD1IF);
//Wait for the A/D conversion to finish
immediateValue = ADC1BUF0;
//Read the value from the A/D conversion
AD1CON1bits.SAMP
= 0;
IFS0bits.AD1IF
= 0;
AD1CON1bits.DONE
= 0;
//Make sure A/D bits are cleared
//End of CTMU read



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com