Jump to content

Search the Community

Showing results for tags 'Analog touch sensor'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • PIC Embedded Programming
    • BoostC and Chameleon compilers programming
    • BoostC porting source code
    • BoostC++ compiler programming
    • BoostBasic compiler programming
    • Assembler programming PIC
    • Novo RTOS Programming
    • Hardware PIC
    • Enhancement Requests
    • Bug Reports

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I'm new to boostc and saw a pic article about using the ADC's as analog touch sensors. http://ww1.microchip...otes/01298A.pdf I've been trying for a couple of days without some success but both channels are getting detected with same value when either button is pressed. Here's what I did: adcon0 = 00000001b; // Turn on the A/D converter, select channel 0 . delay_ms(20); Go_Done=1; // Start conversion while ( Go_Done == 1 ) // Wait for conversion to complete -- better put a timeout in here some time. { } // Separate int's need to be used to keep the shifts from screwing up. shiftH = ad_h; shiftL = ad_l; AD_Result2 = (shiftH<<2) | (shiftL>>6); // Combine the two registers to get full 10 bits. adcon0 = 00000101b; // Turn on the A/D converter, select channel 1 . delay_ms(20); Go_Done=1; // Start conversion while ( Go_Done == 1 ) // Wait for conversion to complete -- better put a timeout in here some time. { } // Separate int's need to be used to keep the shifts from screwing up. shiftH = ad_h; shiftL = ad_l; AD_Result3 = (shiftH<<2) | (shiftL>>6); // Combine the two registers to get full 10 bits. if (AD_Result2 > 500 || AD_Result3 > 500) { //code to output both values goes here } The problem I see is when I hit button 1, both AN0 and AN1 register as input. The microchip doc says I need to set a dummy AN port to VDD and then GND. Has anyone ever done this? Thanks Dan.
×
×
  • Create New...