2022-01-14 01:09 PM
I'm interested in motor speed control. When reading the documentation on the timer modules, it talked about having the counter value saved using a different timer or DMA. What I am wondering is can I read the value manually via an ISR and reset it to 0? Also if you start at 0 and count down I assume it does does twos complement and thus represents -1 by a counter value with full bits?
Thanks
2022-01-14 01:26 PM
> What I am wondering is can I read the value manually via an ISR and reset it to 0?
Yes.
> Also if you start at 0 and count down I assume it does does twos complement and thus represents -1 by a counter value with full bits?
No, it will load the CNT with the value of ARR and generate an update event. Of course, if you set ARR to a value corresponding to -1, which is also the reset value for ARR, then it will load that. Read the section "Downcounting mode" in reference manual. Also AN4776 is recommended.