Best way to reload a running timer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-02-05 11:31 AM
Posted on February 05, 2014 at 20:31
How do I reload a running downcounting timer? Like this:
TIM_UpdateDisableConfig(TIM2, DISABLE);
TIM_SetCounter(TIM2, period);
TIM_UpdateDisableConfig(TIM2, ENABLE);
??
/Frank
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-02-07 9:32 AM
Posted on February 07, 2014 at 18:32
Hi
''How do I reload a running downcounting timer?'' You may not have to. It depends on the mode the Timer is in. The TIMx_ARR register controls the period of the timer. The TIMx_ARR register is buffered so that it can be written to during operation. This is controlled in TIMx_SR1 The new value is used on the next TIMx_CNT overflow. Direction of count does not matter (unless you are trying to change it during operation!). I am sorry but I do not know how to use the Standard Peripheral Library to do this - I have been working with the Timer registers directly.