AnsweredAssumed Answered

measure pulse width using both edge input capture mode

Question asked by Raider E on Apr 26, 2017
Latest reply on May 31, 2017 by Ray Abram

Hi Everyone,


I want to measure the pulse width of a square wave signal and thought about using input capture mode and enable interrupt on both edges (rising and falling) and then in the interrupt routine i will read the signal state if its high or low to determine if its the on cycle or the off cycle. would that save me the hassle of using two pins and configure one on rising and one on falling?


one more thing, does the macro __HAL_TIM_GetCompare ( when placed inside the ISR routine HAL_TIM_IC_CaptureCallback) give me the counter value difference between last two interrupts (rising and falling)?


many thanks