AnsweredAssumed Answered

STM32F4 Change timer period in code

Question asked by Bob Cameroon on Nov 30, 2017
Latest reply on Dec 1, 2017 by Bob Cameroon

Hello

I'm using TIM3 on my STM32F4. Currently TIM3 period is set on 500 (using CubeMX). Is it possible to change it with pressing "User button"?

 

For example


"if (currentPress == 1) {
      htim3.Init.Period = 200;
} else if (currentPress == 2) {
      htim3.Init.Period = 400;
...

}"

 

I guess it could be done via TIM3->.... but I'm not sure how to make it, because I'm beginner.
What I was trying to do was using TIM3->CCR1 = 200, etc.. but it seems like it doesn't work.

 

Thanks for help in addition.

Outcomes