| Electronic Components Datasheet Search |
|
AN1250 Datasheet(PDF) 6 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
AN1250 Datasheet(HTML) 6 Page - Microchip Technology |
|
6 / 22 page ![]() AN1250 DS01250A-page 6 © 2009 Microchip Technology Inc. The software routine for reading each of the sensor channels consists of the following 13 steps: 1. Set all of the A/D converter channels to digital I/O pins and set them to logic zero (‘0’). This has the effect of grounding all of the capacitive touch sensor pads, so they are at zero (0) volts potential. 2. Set the A/D channel to be read to an analog input. 3. Set the A/D converter to the selected channel. 4. Set the discharge bit, IDISSEN, of the CTMUCON register. This step insures that the internal capacitance of the A/D converter starts at zero (0) volts potential. 5. Wait for charge to drain (a few NOPs). 6. Clear the discharge bit, IDISSEN. 7. Set the sample bit, SAMP (AD1CON1), to begin sampling the selected channel (PIC24F only). 8. Set either of the edge status bits of the CTMU. For PIC24F: EDG1STAT OR EDG2STAT (CTMUCON) bits For PIC18F: EDG1STAT OR EDG2STAT (CTMUCONL) bits This step turns on the CTMU current source to the selected A/D channel and begins charging the connected capacitive touch sensor. 9. Wait for a fixed period of time. For most capacitive touch applications, this is approximately 2-10 μS. In this case, the fixed time period is a loop set up to do nothing until the allotted time has expired. 10. Clear the edge status bit that was set above. For PIC24F: EDG1STAT OR EDG2STAT (CTMUCON) bits For PIC18F: EDG1STAT OR EDG2STAT (CTMUCONL) bits This step turns off the CTMU current source and stops charging the connected capacitive touch sensor. 11. Initiate an A/D conversion on the selected channel: a) On PIC24F, clear the SAMP bit (AD1CON1). b) On PIC18F, set the GO/DONE bit (ADCON0). 12. Wait for the conversion to complete. 13. Store the value read by the A/D converter. Figure 3 provides a software flowchart of the CTMU capacitive touch sensor, reading as outlined above. FIGURE 3: CTMU CAPACITIVE TOUCH SENSOR READ FLOWCHART Start Set all of ADC as digital outputs (‘0’) to insure all sensors at zero potential Set selected ADC channel to analog Set Discharge bit, IDISSEN Set ADC to sample selected channel Wait for charge to drain (a few NOPs) Clear Discharge bit, IDISSEN Begin sampling by setting the SAMP bit of the ADC Set the Edge 1 Status bit of the CTMU (EDG1STAT) Wait for the Capacitive Touch Circuit to charge Clear Edge 1 Status bit of the CTMU (EDG1STAT) Start ADC Clearing the SAMP Wait for conversion to to complete: Wait for ADC Interrupt flag (PIC24F) Move the data from the ADC conversion to a temporary variable End (PIC24F only) conversion by: bit (PIC24F) Setting GO/DONE bit (PIC18F) Wait for GO/DONE = 0 (PIC18F) ADC Operation CTMU Operation 1 2 3 4 56 78 9 10 11 12 13 |
|
|
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 |