cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S103 TIM1 Setup External Event Counter

wagnerbs7
Associate
Posted on December 30, 2017 at 02:08

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);

0 REPLIES 0