2020-10-24 02:41 AM
I want to use count external pulses count coming on Timer 1 channel 1 .
I wrote following code. the couter starts counting as I apply external pulses.
but the counter doesnot go upto 65535 value. it gets reset intermittently.
I want to use counter to count incoming pulses continuously and also want to use its overflow interrupt. My code is as below. Please advice me how can I resolve the issue.
GPIO_Init(GPIOC, GPIO_PIN_1,GPIO_MODE_IN_FL_NO_IT );
TIM1_DeInit();
TIM1_TIxExternalClockConfig(TIM1_TIXEXTERNALCLK1SOURCE_TI1,TIM1_ICPOLARITY_RISING, 0x00);//(TIM1_CH1)
TIM1_Cmd(ENABLE);
2020-10-25 10:08 AM
Im not expert for STM8, but maybe your MCU make watchdog resets and you see it as timer resets...
2020-11-05 07:30 AM
maybe try calling
TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 65535, 1);
That way you explicitly set the max count to 65535.