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

use timer 2 in csm module

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



Joined: 03 Sep 2021
Posts: 39

View user's profile Send private message

use timer 2 in csm module
PostPosted: Tue Mar 15, 2022 7:08 am     Reply with quote

Hi everyone
I had a question about the built-in touch sensor module,csm
it's my first time that i use this module
I use micro pic16f723a
And I use timer zero to control delays and timer one to set up the remote control and I did not use timer two
I wanted to read the 4 inputs of spring touch using the internal sensor of the micro, but I was a little confused by reading the data sheet.
I do not know if this module only works with one timer or two timers now.
Can I transfer this module's timer in CCS to only timer 2 that i did't use?
if yes how?

Thank you for your help
Ttelmah



Joined: 11 Mar 2010
Posts: 19491

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 9:14 am     Reply with quote

Normally capacitive sensing uses one timer for the timing, and one for
the interval between. The second can be re-used by your own code,
by setting the interval to the value you want, and simply adding your
own handler for this interrupt. The two handlers get called one after
the other. The #use sets this timer up (so don't change the settings
for this timer in your code).
So, let timer0 go free. If the interval can be the same as your delay
function, use timer1 for this, and then use timer2 for your remote control.
temtronic



Joined: 01 Jul 2010
Posts: 9220
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Mar 15, 2022 9:19 am     Reply with quote

I looked at the datasheet, CSM chapter, diagram.
While timer2 can be used as a 'gate', it can't be used as the actual 'timing' element.
There may be a way to use timer0 and timer 1 for all your functions, if you can use the interrupts from them though.
GiG



Joined: 03 Sep 2021
Posts: 39

View user's profile Send private message

PostPosted: Wed Mar 16, 2022 2:38 am     Reply with quote

Thank you Ttelmah

temtronic

I clearly did not understand what you mean. Can you explain a little more?
Thanks
look at me as a beginner
Ttelmah



Joined: 11 Mar 2010
Posts: 19491

View user's profile Send private message

PostPosted: Wed Mar 16, 2022 4:39 am     Reply with quote

Jay was suspicious that your remote control and timings might all be doable
on just one interrupt.
temtronic



Joined: 01 Jul 2010
Posts: 9220
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 16, 2022 6:10 am     Reply with quote

Have a look at this...

http://www.ccsinfo.com/forum/viewtopic.php?t=26177

See what happens in the actual ISR.


It's a timer based Real Time Clock that uses one timer interrupt to update several variable ( second,minutes, hours )

You could do a similar interrupt, where you increment several 'flags'. Then in main(), you do 'something' based upon what those 'flags' are.
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