Hello everyone,
I would like to ask to who has more experience with this.
I have a custom sensor that outputs data by a varying frequency. Now i don't just need to measure the frequency. What i need is actually the High time, but of course, if the frequency changes, the high time also does.
The duty percentage should stay the same, it should be linear. Still i would like to measure the High time directly.
What i have currently is a rising edge interrupt on a digital pin, start a timer, wait for a falling edge interrupt, register the timer value.
Okay, but now i would like to use edge-time capture mode of the timer. The issue i am seeing is that i would need to have the timer work for both edges. Interrupt on rising edge, register value ,wait for falling edge, register value. I see issues because of overflows since the frequency is not fixed.
I could use a digital interrupt on rising edge to start the timer and a edge-time interrupt on falling edge in which then i reset/stop the timer, assuming i use a Load value high enough. This would be more precise than the first method. Still i would like it to be more precise, but it doesn't seem viable with just 1 timer, am i correct?