Skip to main content
imanpakii
Associate III
December 22, 2012
Question

Timer1 capture data

  • December 22, 2012
  • 4 replies
  • 1004 views
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

   
    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    December 22, 2012
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    imanpakii
    imanpakiiAuthor
    Associate III
    December 22, 2012
    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.

     

    Tesla DeLorean
    Guru
    December 22, 2012
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    imanpakii
    imanpakiiAuthor
    Associate III
    December 22, 2012
    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.