2019-01-22 08:44 AM
Hey guys, i have problem about counters, i have a constanst frequency square wave ring tone signal and this signal have to come to my mcu's input pin and i have to detect it that is ring tone, i think i will gonna do this with counters, i have to open timers for a while and at these times timer try count ticks. B
But i dont know how to configure it and how to add interrupt routines to my codes block. Can u help me ? I found some code below but im not sure about and i dont know how to do.
void TIM1_setup(void)
{
TIM1_DeInit();
TIM1_TimeBaseInit(2000, TIM1_COUNTERMODE_UP, 55535, 1);
TIM1_CCxCmd(TIM1_CHANNEL_1, ENABLE);
TIM1_ICInit(TIM1_CHANNEL_1, TIM1_ICPOLARITY_RISING, TIM1_ICSELECTION_DIRECTTI, 1, 1);
TIM1_ITConfig(TIM1_IT_CC1, ENABLE);
TIM1_Cmd(ENABLE);
enableInterrupts();
}
2019-01-22 09:08 AM
anyone help ??