2007-03-25 01:25 AM
2011-05-17 12:39 AM
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.com2011-05-17 12:39 AM
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 ]2011-05-17 12:39 AM
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