PWM signal reading problem

Hi

I tried to write my own PWM to PPM code to an Arduino Pro Mini.
The PPM generation is working fine, only 14 microsecond delay in the signal, but this is rock solid.
But he polling of PWM inputs are too laggy. The result is about 60-80 microseconds shaking in the signal continiously.
Is there any other way of scanning more PWM inputs without this shaking result?

My code is attached to the post.

Thanks

Zoltan

pwm2ppm.ino (2.89 KB)

Hi

Finally I found a solution to my problem.
Two steps to be happy:

  • use direct port access instead of digitalWrite and digitalRead
  • use pinchange interrupt instead of polling loop

With this I was able to renew my old HK-TR6A receiver to a PPM receiver with failsafe :slight_smile:

Here is the final version: GitHub - PZotya/PWM2PPM: How to turn old PWM receiver without failsafe to a PPM receiver with failsafe