Capacitive sensing with the CSM module, 16F1823 & learning about interrupts


Results 1 to 6 of 6

Threaded View

  1. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Capacitive sensing with the CSM module, 16F1823 & learning about interrupts

    Firstly big oops on my part... no, you can't use timer0 for both the interrupt AND the CPS oscillator output counting, (like I say, my snippets were from a humungous program that I hacked very quickly & tried to condense as much as possible - got carried away clearly) but hey you got there!!

    Any way as you've done, it's best to use timer1 for counting the CPS pulses, and timer0 for the timebase.

    You can program the 16f1823 with a Pickit2 (http://www.microchip.com/stellent/id...cName=en027813) ....just make sure you've the latest PIckit2 device file

    Yes, it's best to clear timer0 at the end of the timer0 interupt (though this'll be the point we're the old hands chime in "no need, it gets cleared for you", etc)

    The thing about CPS that doesn't get mentioned, is using DT's interrupts coupled with the high interrupt rate normally needed for a decent sensor feel/response, means your little pic is working quite hard just for cap touch alone ...therefore, you want to interrupt as little as you can get away with but still have a decent sensor response feel. For example, if you only interrupt every half second, it might feel sluggish (also the longer you make the period between interrupts, the more you timer1 is gonna count oscillator pulses - watch the timer1 oscillator count doesn't get near 65536 and overflow, if it's getting towards that, take the CPS oscillator frequency down with the CPSCON register setting (bits 4-2)
    Last edited by HankMcSpank; - 10th September 2011 at 10:09.

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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