Oh dear, I've backed myself into a corner (at least a corner of my own knowledge!).
I'm running here a 16f1824...& have got the cap sense running fine...paid special attention to using the timer that still runs during sleep (timer1), also the cap sense module runs while asleep - soin my naive liuttle world, all is scoop'ndaddy, but then I hit this in the datasheet....
9.1 Wake-up from Sleep
The device can wake-up from Sleep through one of the
following events:
1. External Reset input on MCLR pin, if enabled
2. BOR Reset, if enabled
3. POR Reset
4. Watchdog Timer, if enabled
5. Any external interrupt
6. Interrupts by peripherals capable of running during
Sleep (see individual peripheral for more
information)
???
(that's my bold too - is a Timer interrupt deemed an 'external interrupt'?)
How on earth can I get the PIC to trap a finger being placed on a sensor while it's asleep?
Just for the record, here's what my program does...
timer 4 gets cleared
timer 4 starts running
the cap sense module output feeds into timer1 (timer1 is my cap sense oscillator 'count')
timer4 overflows (this is my timebase)
in a DT interrupt routine I compare the timer1 'count' vs the last timer1 'count' - if it has deviated down by more than 15% then a sensor has been touched - switch pressed!
timer 1 gets cleared
timer 4 gets cleared
rinse repeat.
So in the overall flow, a timer interrupt (for the timebase) is pretty key to cap sense working)
Like I say, it all works like a charm when awake, but I deffo need this circuit to go to sleep .....and then I really need the cap touch sensor to awake the PIC from its slumber.
So out of that overall 'flow' how can I keep tracking the timer 1 count while asleep? I'm figuring I can't and will have to come out of sleep say every few seconds to check the timer1 counts? Can theTimer4 overflow even wake the PIC up (even if it can. it's not eally the solution as obviously, timer4 is interrupting heavily...and the PIC would never get the chance to shut it's eyes)
ideas sought from those that are used to such conundrums?
Bookmarks