cancel
Showing results for 
Search instead for 
Did you mean: 

Timer1 capture data

imanpakii
Associate III
Posted on December 22, 2012 at 02:07

Hi all

i run timer 1 in capture mode and i want to know how can i reset the counter.

for example i capturing signal and store it  in an array. The counter counting from 0 to 65535 and every time edge comes in interrupt routine i read counter value and subtract it from last value but sometimes  i need too rest counter value how can i do that please help me Thank you

   
4 REPLIES 4
Posted on December 22, 2012 at 04:05

Can't you just write to the TIMx->CNT register? But if you're just computing a delta between two readings I'm not sure why you'd need to reset it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
imanpakii
Associate III
Posted on December 22, 2012 at 04:50

Thank you for your fast reply 

because sometime my signal stream off and i want to clear counter in this time.

But i don't know how can i clear counter reg.

 

Posted on December 22, 2012 at 04:56

But i don't know how can i clear counter reg.

Try writing zero to it, it is documented to be a R/W register.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
imanpakii
Associate III
Posted on December 22, 2012 at 05:11

Thank you Clive1

 TIMx->CNT =0;

Arg1=

 TIMx->CNT;

was work.

Thank you for your help. It's helpful as usual.