2026-04-14 3:57 AM - last edited on 2026-04-15 3:31 AM by Andrew Neil
I am generating a PWM signal using timer1 register and use it in Center aligned mode. I want to to know if i can modify the timer counter register TIMx_CNT register with some "x" value in the timer interrupt instead of resetting it to 0.
Solved! Go to Solution.
2026-04-15 3:11 AM
Hello @STuser2
It should be possible.
Here is a project that writes the CNT register of TIM6 after the first interrupt occurs to change the period from 10 seconds to 5 seconds.
You can use it as an example.
BR
Gyessine
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-04-14 6:01 AM
Yes, you can change the CNT register value at any time. It will affect your PWM signal.
2026-04-15 3:11 AM
Hello @STuser2
It should be possible.
Here is a project that writes the CNT register of TIM6 after the first interrupt occurs to change the period from 10 seconds to 5 seconds.
You can use it as an example.
BR
Gyessine
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-04-15 7:52 PM
Yes i was able to update and get it working but only in the up counting mode not in Center Aligned mode, is there any method i can follow so that the counter counts from some "X" value to ARR and from ARR to "X" value.
2026-04-16 10:17 PM
Could you please provide comment if it is possible in center aligned mode or not?
2026-04-17 6:04 AM
Counters cannot count from X to ARR unless X is 0.