View previous topic :: View next topic |
Author |
Message |
Mrtgl
Joined: 15 Sep 2020 Posts: 6
|
Touchpad and sleep mode |
Posted: Tue Sep 15, 2020 10:28 am |
|
|
Hello everyone, I want to wake up a microcontroller in sleep mode with internal capacitive touch. I could not find any examples for this on the internet. Does anyone have an example or can explain how to do it? The microcontroller I used is PIC16F1829. Thanks... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Tue Sep 15, 2020 11:30 am |
|
|
The capability for this doesn't really exist.
The CPS module can stay awake (must be using timer1, not timer0), and
you'd have to configure it to be using it's lowest current setting,
otherwise this will use more than the chip... It can record readings,
but not detect that a change has occurred. So no ability to trigger a
wake. What you can do is wake every time the timer overflows, and then
record/compare the value recorded to detect if a touch has occurred. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9247 Location: Greensville,Ontario
|
|
Posted: Wed Sep 16, 2020 8:36 am |
|
|
It's probably easier to just add a pushbutton to any of the IOC pins (port A pins or port B pins).
A quick read of the datasheet says any of those pins will wakeup the PIC from sleep.
If saving power is the goal, this might be the best approach, though a true test would have to be done on the bench.....
Jay |
|
|
Mrtgl
Joined: 15 Sep 2020 Posts: 6
|
|
Posted: Wed Sep 16, 2020 1:04 pm |
|
|
Ttelmah wrote: | The capability for this doesn't really exist.
The CPS module can stay awake (must be using timer1, not timer0), and
you'd have to configure it to be using it's lowest current setting,
otherwise this will use more than the chip... It can record readings,
but not detect that a change has occurred. So no ability to trigger a
wake. What you can do is wake every time the timer overflows, and then
record/compare the value recorded to detect if a touch has occurred. |
I know the method you said. I used it on the previous version of the circuit. But I don't want to use a physical button in the circuit. |
|
|
Mrtgl
Joined: 15 Sep 2020 Posts: 6
|
|
Posted: Wed Sep 16, 2020 1:09 pm |
|
|
Ttelmah wrote: | The capability for this doesn't really exist.
The CPS module can stay awake (must be using timer1, not timer0), and
you'd have to configure it to be using it's lowest current setting,
otherwise this will use more than the chip... It can record readings,
but not detect that a change has occurred. So no ability to trigger a
wake. What you can do is wake every time the timer overflows, and then
record/compare the value recorded to detect if a touch has occurred. |
There is such information in datasheet:
"The capacitive sensing oscillator will continue to run as long as the module is enabled, independent of the part being in Sleep. In order for the software to determine if a frequency change has occurred, the part must be awake. However, the part does not have to be awake when the timer resource is acquiring counts." |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9247 Location: Greensville,Ontario
|
|
Posted: Wed Sep 16, 2020 1:38 pm |
|
|
The problem is that although the CPS module will run when the PIC is asleep, there is no direct INTERRUPT capability by the CPS module,as I read the datasheet.
However, IF, the CPS is sent to Timer1, then it 'might' be possible to have the Timer1 interrupt while in sleep mode.
I've never used the CPS module and it presupposes you're NOT using Timer1 for anything else. I don't have that PIC so I can't suggest code, just that it 'might' be possible, at least the way I read it and look at the diagrams.
As you already have that PIC, it'd be worth a try....
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19553
|
|
Posted: Thu Sep 17, 2020 1:17 am |
|
|
Yes, exactly.
It can make the acquisition, but has no ability to 'detect' an event, or signal
the processor to wake.
You have to wake up using the timer, and then in code take the result
and test for a touch event.
A pretty useless ability really, especially considering how much power
the module uses, compared to the processor itself at a low speed.
So honestly best solution is just to keep the processor awake. |
|
|
|