Cap Sense ...getting a drowsy PIC to wake out of sleep!!


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Ooh, now I see what you are doing. I got this CSM working with a 16F727 and other chips but not in sleep mode. It is good to know that it works in sleep mode. Don't you have inaccurate value readings with the WDT as the timeframe interrupt? I read somewhere that the WDT is not too accurate.

    Also, you said that you are using WDT intervals of two seconds. I didn't know you could go that high. I guess that a quick touch is not going to be detected by your device. I have used intervals in the order of a few milliseconds.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Quote Originally Posted by rsocor01 View Post
    Ooh, now I see what you are doing. I got this CSM working with a 16F727 and other chips but not in sleep mode. It is good to know that it works in sleep mode. Don't you have inaccurate value readings with the WDT as the timeframe interrupt? I read somewhere that the WDT is not too accurate.
    The readings only waiver by about 1%....a finger press see the deviation something like 80% ...plenty of headroom there!.



    Quote Originally Posted by rsocor01 View Post
    Also, you said that you are using WDT intervals of two seconds. I didn't know you could go that high. I guess that a quick touch is not going to be detected by your device. I have used intervals in the order of a few milliseconds.
    According to the datasheet, the 16f1824 can have a WDT period of 256 seconds....but that'd be impossible to use with capacitive touch & sleep (timer1 would always overflow while asleep, as it's not possible to set the CSM output frequency low enough to avoid a timer1 overflow for 256 seconds!).

    You are correct about quick tap not working when the WDT period is 2 seconds ...so, I'm using two sleep periods.

    My first sleep period is only about 64ms ...that's very responsive to quick taps. Then after no finger taps detected for over 60 minutes, I actually then extend the sleep period out to about 2 seconds.......& yes, that requires you to hold you finger on the sensor for about two seconds... however once it comes out of sleep in this mode, I put the the WDT back to about 64ms.

    the reasoning behind this, is that when a user first turns the circuit on, he'll have to hold his finger on the sensor for 2 seconds...but from thereon, it'll be responsive/snappy .....then if he stops using the circuit, it'll go into longer sleeps to conserve battery power.
    Last edited by HankMcSpank; - 10th May 2011 at 10:22.

  3. #3
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    If you use the Timer1 to count the CSM pulses, how do you setup the "Timer1 Gate Source Selection"=T1GSS bits ?

    Best Regards,
    Bogdan

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Quote Originally Posted by bogdan View Post
    If you use the Timer1 to count the CSM pulses, how do you setup the "Timer1 Gate Source Selection"=T1GSS bits ?

    Best Regards,
    Bogdan
    Good question.

    I use T1GSS=01 because I use the "Timer0 Overflow Output". I have seen some people using T1GSS=10 which is for "TMR2 Match PR2 Output". HankMcSpank is probably using the last option T1GSS=11 which is "Watchdog Timer Scaler Overflow".

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Quote Originally Posted by bogdan View Post
    If you use the Timer1 to count the CSM pulses, how do you setup the "Timer1 Gate Source Selection"=T1GSS bits ?

    Best Regards,
    Bogdan
    i don't touch those bits (so whatever they default to). to get Timer1 to count the CSM output, I simply set this...
    Code:
    T1CON = %11000101       'SOURCE TIMER1 CLOCK FROM CAPSENSE MODULE

  6. #6
    Join Date
    Jan 2009
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Do you guys use the:
    a) Timer1 Gate Interrupt (triggered by the overflow of the timebase timer )
    or
    b) Timebase timer Interrupt (overflow)
    ...and when one of those interrupts is serviced checking the counts on the timer1

    (microchip AN1171 http://www.google.com/url?sa=t&sourc...eJmWE1g8kxdKZg say to use a).... why????)

    Thank You
    Last edited by bogdan; - 13th May 2011 at 02:39. Reason: spelling

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Quote Originally Posted by bogdan View Post
    Do you guys use the:
    a) Timer1 Gate Interrupt (triggered by the overflow of the timebase timer )
    or
    b) Timebase timer Interrupt (overflow)
    ...and when one of those interrupts is serviced checking the counts on the timer1
    b) - I use timer2 interrupt (via DT's interrupts) as the timebase... & in the interrupt routine, I check the actual timer1 counts (ie as received from the cap sense module).

    When I put the PIC to sleep, because timer2 can't be used while it's sleeping, I use the WDT as the necessary timebase.

  8. #8
    bent10's Avatar
    bent10 Guest


    Did you find this post helpful? Yes | No

    Default Re: Cap Sense ...getting a drowsy PIC to wake out of sleep!!

    Im also using the Pic16f1824 and would liek to capsense working for a SLEEP/ WAKEUP button. I understand the flow of how yo uare using the WDT to do this however I am having trouble getting the capsense to work in general. Would you be able to give light on config bits for using timer1 and capsense channel 2?

    Thanks for all the help.

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