Skip to main content
m_j_butcher
Associate III
March 25, 2007
Question

Timer counter register

  • March 25, 2007
  • 3 replies
  • 792 views
Posted on March 25, 2007 at 10:25

Timer counter register

This topic has been closed for replies.

3 replies

m_j_butcher
Associate III
May 17, 2011
Posted on May 17, 2011 at 09:39

Hi All

I have used 16 bit timer 2 to generate a delay and an interrupt when it times out.

I made a simple match and then stopped the timer in the interrupt routine.

I am however wondering whether there is a mode which will automatically stop the timer and reset the timer counter at the end of this, which I haven't been able to interpret yet? Anyone know?

Also I found the the only way that I could get the timer counter to start at 0 (0xfffe) again for the next delay was to write a value to the register address (any value). This works fine but the register is actually a read-only register and this behavious os not described in the users' manual. What is the best way and can 'my' method be relied upon??

Best regards

Mark Butcher

www.uTasker.com

m_j_butcher
Associate III
May 17, 2011
Posted on May 17, 2011 at 09:39

Thanks

In the ST library the command to reset the counter is to write the value 0x1234 to the counter, although the actual value is obviously not important.

However I can not find any reference to this technique in the users' manual where the counter is defined as having read-only characteristics. But now I know how it works.

Regards

Mark

amira1
Associate
May 17, 2011
Posted on May 17, 2011 at 09:39

Hi mjbcswitzerland,

Could you please refer to the user manual (page 133). The TIM_CounterCmd(TIM2, TIM_CLEAR) instruction gets the timer counter to start at the reset value (0xFFFC) or you can write any value to the counter register as you said.

with best regards,

mirou

[ This message was edited by: mirou on 23-03-2007 08:49 ]