AnsweredAssumed Answered

TIM1 counter

Question asked by Klszcz on Mar 8, 2012
Latest reply on Mar 13, 2012 by Klszcz
I try measure frequency 50-500Hz. I use STM8S-DISCOVERY KIT with STM8S105C6T6 and FWLib. How initiate the appropriate timer and which port to use?

#include "stm8s_conf.h"
#include "stm8s.h"
#include "stm8s_it.h"
#include "stm8s_tim1.h"
#include "stm8s_gpio.h"
void init(void);
void GPIO_app_init(void);
void TIM1_app_init(void);
while (1)
        tim1freq = TIM1_GetCounter();
void init(void)
void GPIO_app_init(void)
void TIM1_app_init()
    TIM1_TimeBaseInit(31, TIM1_COUNTERMODE_UP, 65535, 0)
    TIM1_CounterModeConfig (TIM1_COUNTERMODE_UP);