| Electronic Components Datasheet Search |
|
AN1250 Datasheet(PDF) 5 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN1250 Datasheet(HTML) 5 Page - Microchip Technology |
|
5 / 22 page ![]() © 2009 Microchip Technology Inc. DS01250A-page 5 AN1250 EXAMPLE 2: CTMU AND A/D CONVERTER SETUP FOR PIC18F 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. //setup CTMU //CTMUCON CTMUCONHbits.CTMUEN = 0; //make sure CTMU is disabled CTMUCONHbits.CTMUSIDL = 0; //CTMU continues to run in idle mode CTMUCONHbits.TGEN = 0; //disable edge delay generation mode of the CTMU CTMUCONHbits.EDGEN = 0; //edges are blocked CTMUCONHbits.EDGSEQEN = 0; //edge sequence not needed CTMUCONHbits.IDISSEN = 0; //Do not ground the current source CTMUCONHbits.CTTRIG = 0; //Trigger Output is disabled CTMUCONLbits.EDG2POL = 0; CTMUCONLbits.EDG2SEL = 0x0; //Edge2 Src = ECCP2 (don’t care) CTMUCONLbits.EDG1POL = 1; CTMUCONLbits.EDG1SEL = 0x1; //Edge1 Src = ECCP1 pin (don’t care) //CTMUICON CTMUICON = 0x03; //55uA CTMUICON.ITRIM = 0; //Nominal - No Adjustment //setup A/D converter ANCON0bits.PCFG = 0x00; ANCON1 = 0x0000; ADCON0bits.CHS = 0x00; //select the analog channel 0 ADCON1bits.ADFM = 0x00; //right justified result ADCON1bits.ADON = 1; //Turn On A/D CTMUCONHbits.CTMUEN = 1; //Enable CTMU |
|
|
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 |
| 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 |