CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Touchpad and sleep mode

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Mrtgl



Joined: 15 Sep 2020
Posts: 6

View user's profile Send private message

Touchpad and sleep mode
PostPosted: Tue Sep 15, 2020 10:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Sep 15, 2020 11:30 am     Reply with quote

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: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Sep 16, 2020 8:36 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 16, 2020 1:04 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 16, 2020 1:09 pm     Reply with quote

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: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Sep 16, 2020 1:38 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 17, 2020 1:17 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group