AnsweredAssumed Answered

STM8S103 TIM1 Setup External Event Counter

Question asked by silva.wagner.001 on Dec 30, 2017

Hi,

 

Please, could someone help me to setup TIM1 to count pulses at rising edges? I try this code, but doesn't works.

 

TIM1_DeInit();

TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 581, 0);

 TIM1_ICInit(TIM1_CHANNEL_1, TIM1_ICPOLARITY_RISING, TIM1_ICSELECTION_DIRECTTI,  TIM1_ICPSC_DIV1, 0x00);

TIM1_TIxExternalClockConfig (TIM1_TIXEXTERNALCLK1SOURCE_TI1ED, TIM1_ICPOLARITY_RISING, 0);

TIM1_ClearFlag(TIM1_FLAG_CC1 | TIM1_FLAG_UPDATE);

TIM1_Cmd(ENABLE);

Outcomes