Relaxation oscillators (for capacititive touch sensing)


Results 1 to 25 of 25

Threaded View

  1. #9
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Ah... I see what I wrote with regard to DIGITAL OUTPUT... what I meant was that the COMPARATOR gives you the Digital Output. You NEED to select C1OE and C1ON (C2OE & C2ON) bits to 1 so the Comparator gives you a physical Hardware Output (rather than just setting a bit in a Register internally within the PIC), and you set the TRIS for that pin to 0 (treat it as DIGITAL OUTPUT - which is what it is).
    Ok, I think I understand, that's pretty much what their Application Note said (albeit for the 16f877, but doing some x correlation, it seems that most register settings on the 16F690 are very similar)...


    Edit: Bingo! it works now!(phew)

    The problem?

    The darned Pickit2 programmer pin 2 (which goes to pin 18 - ICSPCLK -on the 16F690), was seemingly dragging the whole cct down and stopping it from oscillating - when I removed that leg from my Pickit2 & I get the following...



    (which alters in frequency nicely when I touch my fingers across the 250nf cap I have in place in lieu of the C3 sensor pad/cap in the schematic above)

    For the capactive touch record, here are my register settings...

    Code:
    CM1CON0= %10010100    'from the Microchip AN1011a application note.
    CM2CON0= %10100000    'from the Microchip AN1011a application note.
    CM2CON1= %00110010    'from the Microchip AN1011a application note.
    SRCON  = %11110000    'from the Microchip AN1011a application note.
    VRCON  = %10000111    'from the Microchip AN1011a application note.
    
    ANSEL  = %00001010    'AN1 & AN4 analogue, the rest Digital.
    
    TRISA  = %11111011     'RA1 (C12IN0-) as input, RA2 (C1Out ) output - but not sure if it's in scope here!
    TRISC  = %00000011     'RC0 (VCC/4) as input, RC1 Input (not sure if it's in scope either), RC4 output (C2OUT)
    Thanks for chiming in, your input made me revisit this one last time (I was flagging!) ....that's the simple bit over with (which has taken me two nights!), now the hard stuff - getting this all to work!
    Last edited by HankMcSpank; - 22nd November 2009 at 20:26.

Similar Threads

  1. Need a cheap touch sensor idea.. here it is
    By mister_e in forum Code Examples
    Replies: 20
    Last Post: - 16th April 2016, 22:42

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts