How to get state of the pulse (High or Low) when using Input Capture mode.
In my application I need to design a multi purpose digital input which can operate in 3 modes
- ON/OFF detection
- Frequency measurement and
- Pulse Counting
I can do the last 2 using HW Timers in Input Capture mode and configuring it for both edges. In the alternate interrupts I calculate frequency and I have a separate counter to count pulses on every interrupt and then divide the final result by 2 since the interrupt is for both edges.
But for the first application I am unable to find a solution. The application needs to be able to change the Input modes on the fly so I was thinking that anything in Input Capture mode will be helpful.
Thanks