Question
measure time duration
Posted on July 13, 2011 at 09:19
I have a string of pulses coming in, and i want to measure the period of a pulse. So i have initialize the input capture for the timer, in my case TIM2 CH4.
RCCIC_Configuration(); /* NVIC configuration */ NVICIC_Configuration(); /* Configure the GPIO ports */ GPIOIC_Configuration(); TIM_ICInitStructure.TIM_Channel = TIM_Channel_4; TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI; TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; TIM_ICInitStructure.TIM_ICFilter = 0x0; TIM_ICInit(TIM2, &TIM_ICInitStructure); /* TIM enable counter */ TIM_Cmd(TIM2, ENABLE); /* Enable the CC4 Interrupt Request */ TIM_ITConfig(TIM2, TIM_IT_CC4, ENABLE); but how do i go about starting the time duration measurement when i see a ''1'' at my input and count until another ''1'' appears? #stm32 #pulse #time-duration