Non Blocking pulsein() for Due

Hello Guys,

Does any of you know a library for non blocking pulsein library that supports the Due?

I have found a few but non of them supports the Due and I need some help to fined one.

Thanks,

I have a sketch to measure PWM on arduino DUE, see if it fits to you: http://coolarduino.blogspot.ca/2015/06/frequency-counter-for-arduino-part-2.html

Thanks you Magician,

Your application works well but I need to modify it to my needs and I have no clue what is going on there (newbie programmer, actually just a mechanical engineer) in the Handler/ counter and pio_TIOA1.

I need it to just send the pulse width (ether falling / rising or both) immediately when it happens and no need to count or calculate anything.

I am reading a wheel encoder close to the stop point of the wheel (when the pulses are getting slower) to calculate the exact wheel stop time before it happens using also an accelerometer, so I need to get the pulse length continuously immediately after if finishes.

Can you please send me in the right direction on how to do this?

Thanks,

I have no clue what is going on there (newbie programmer, actually just a mechanical engineer) in the Handler/ counter and pio_TIOA1.

I was sure, that any teenager could understand the code, itself explicable. Don't have to be rocket science engineer:

            | TC_CMR_LDRA_RISING     
             | TC_CMR_LDRB_FALLING

Obviously, LDRA keeps "timestamp" of the rising edge of the pulse, and LDRB - falling.
Or, should I explain what is the "pulse"? Google or Wiki, rings a bell?

I need it to just send the pulse width (ether falling / rising or both) immediately when it happens and no need to count or calculate anything.

"Ether falling / rising" - its complete non-sense. Pulse is a difference between falling AND rising, so you need to know both.
"no need to count or calculate anything." ???

Send to you in what units? Arduino has no means to know if its microsec, milisec, hours, or years? BTW, arduino has no normal clock/watch ether, its count in 42 MHz units, so you must calculate to get meaningful result.

Code does 99% of your objective, calculate pulse width based on duty cycle and period, using formula from wiki. Elementary school math.

The whole blog Magician pointed to is gone, but wayback machine still has it :wink:
http://web.archive.org/web/20151109013759/http://coolarduino.blogspot.ca/2015/06/frequency-counter-for-arduino-part-2.html