For a project, I have to make measurements on radar signals : an A signal, continous, squared and symmetrical, with a frequency of 4 kHz/a period of 250 µs, representing the 16 384 radar pulses, and a B signal, a single pulse lasting 125 µs every 4.096 seconds, showing that a new lap has started.
I want to make two measures on each signal : counting the number of pulses (so in theory 16 384 signal A pulses between two signal B pulses), and couting the length of each pulse (still in theory 250 / 2 = 125 µs).
Using interrupts, I managed to count accurately the pulses of both signals, so this part is ok.
The problem is measuring in parallel the length of the pulses of both signals : at first I used the micros() function on rising and falling edges, then calculated the substraction to get the length of the pulses. Unfortunately, this function "only" offers a 4 µs accuracy, and I want 1 µs accuracy.
Then I tried the pulseIn() function, which seems to offer 1 µs accuracy, but it is blocking : the signal B pulses are separated by about 4 seconds, so in the meantime, the length of the signal A pulses are not measured.
Today I worked with protothreads and a library offering 0.5 µs accuracy, but I didn't manage to do what I want.
So, before being lost in a huge amount of code, I'm here to ask you for your help : do you have any advice on this project ? Is it feasible ? Do you have any idea to help me progress ?
Thank you in advance ! :)
PS : I also posted in the French subsection as French is my native language, so it is easier for me to explain things, but the Project Guidance subsection fits better my needs. I'll keep both topics updated.