Relaxation oscillators (for capacititive touch sensing)


Results 1 to 25 of 25

Threaded View

  1. #16
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Well thanks for checking back...and holding back on the scorn!

    I've got Timer1 counting now, here's the magic combination of 1 & 0's (just in case any other 16f690'ers wanting to get their relaxation oscilator working into Timer1 & stumble upon this thread via Google)...

    T1CON = %10000111

    Also....

    Code:
    '-----Allocate Variables
    timercount   var    word  ' raw count from TMR1
    
    '----Main loop-----------------------------------------------------------
    Main:
    timercount = TMR1L + TMR1H << 8
        DEBUG " timerCount= ", DEC timercount, 13, 10
        pause 50  
    GOTO Main
    end
    .....of course the bit in bold needed to be in my loop....else I'd always have the same timer1 value showing up onscreen.

    Anyway, not a totally unsuccessful night...got my oscillator oscillating and my timer1 incrementing - gotta pull all this together now with something like you've suggested Darrel. (I can't help but base my code on others ....even if it only applies loosely - I have to start with something & start stripping away the bits I don't need - if nothing else it shows me what registers are in play & forces me to try & understand them!)

    & so....to bed.

    Thanks to you all for bearing with me in my somewhat 'white noisy' thread.

    PS: Just so I've something to wake up to in the morning, what's wrong with this high level concept for measuring the incoming frequency at Timer1 input....

    Clear Timer0 (have it counting the internal clock)
    When Timer0 overflows (which should always be the same time period?), use the Timer0 'overflow interupt' to then trigger a bit of code to read in the contents of timer1
    if the contents of timer1 is more or less the same as the previous sample content, then no finger has gone near the sensor, if the value is significantly lower, then essentially a pseudo-button has been pressed
    Clear timer 1
    Clear timer 0
    rinse, repeat?


    [dives for cover waiting to be shot down in flames]
    Last edited by HankMcSpank; - 23rd November 2009 at 02:07.

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, 23: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