I am using Tiva. TM4C123GXL.
On a pin F4, there is connected external device which generates pulse (HC-SR04). I want to measure that pulse width.
My idea is:
When pulse arrives (transition high-to-low), I will start a timer. And it will count down. I know that maximal pulse width is 23 milliseconds (so I put 100 ms in timer).
When pulse is over (transition low-to-high), I will read timer value.
Defeerence between those 2 ticks, I will multiply by system frequency (50 MHz).
And it will be my pulse width.
Right?
But, whatever I do, I got pulse width equal to 99 milliseconds.
(With