cancel
Showing results for 
Search instead for 
Did you mean: 

STM timer query

ST MICROCONTOLLER
Associate II
Posted on December 06, 2016 at 13:59

We are working on a project based on timer in which we keep facing an error : symbol _TIM1_SetCounter not defined. We have included the header files as well. Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Nesrine M_O
Lead II
Posted on December 06, 2016 at 14:19

Hi

,
  • The_TIM_SetCounter function is defined as below:

/** * @brief Sets the TIMx Counter Register value * @param TIMx: where x can be 1 to 14 to select the TIM peripheral. * @param Counter: specifies the Counter register new value. * @retval None */void TIM_SetCounter(TIM_TypeDef* TIMx, uint32_t Counter){ /* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); /* Set the Counter Register value */ TIMx->CNT = Counter;}�?�?�?�?�?�?�?�?�?�?�?�?�?�?

  • example how to use it:

TIM_SetCounter(TIM1, 100);

-Nesrine M-

View solution in original post

5 REPLIES 5
Nesrine M_O
Lead II
Posted on December 06, 2016 at 14:19

Hi

,
  • The_TIM_SetCounter function is defined as below:

/** * @brief Sets the TIMx Counter Register value * @param TIMx: where x can be 1 to 14 to select the TIM peripheral. * @param Counter: specifies the Counter register new value. * @retval None */void TIM_SetCounter(TIM_TypeDef* TIMx, uint32_t Counter){ /* Check the parameters */ assert_param(IS_TIM_ALL_PERIPH(TIMx)); /* Set the Counter Register value */ TIMx->CNT = Counter;}�?�?�?�?�?�?�?�?�?�?�?�?�?�?

  • example how to use it:

TIM_SetCounter(TIM1, 100);

-Nesrine M-

Posted on December 06, 2016 at 16:53

Header files describe interfaces they don't add code for those interfaces. You need to add the stm32fxx_tim.c type files to the project so the code you are calling actually gets into the linker.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ST MICROCONTOLLER
Associate II
Posted on December 07, 2016 at 09:24

Thank all, but we are still receiving a few errors. We are working on stm8s controller. So is there a different .c file that we have to add?

Posted on December 07, 2016 at 09:32

Hi

BUCH.NISHAD

‌,

Your question will be redirected to

https://community.st.com/community/stm8-mcus

forum.

-Nesrine-

Ifmy suggestanswers your question, please mark it as correct.

Posted on December 07, 2016 at 09:34

Thanks and sorry for inconvenience. I was unaware of the stm8 forum.