cancel
Showing results for 
Search instead for 
Did you mean: 

Timer counter register

m_j_butcher
Associate II
Posted on March 25, 2007 at 10:25

Timer counter register

3 REPLIES 3
m_j_butcher
Associate II
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

amira1
Associate II
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 ]

m_j_butcher
Associate II
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