Skip to main content
Visitor II
December 6, 2016
Solved

STM timer query

  • December 6, 2016
  • 3 replies
  • 1733 views
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.

    This topic has been closed for replies.
    Best answer by Nesrine M_O
    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-

    3 replies

    Visitor II
    December 6, 2016
    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-

    Graduate II
    December 6, 2016
    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.

    Visitor II
    December 7, 2016
    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?

    Visitor II
    December 7, 2016
    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.

    Visitor II
    December 7, 2016
    Posted on December 07, 2016 at 09:34

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