Uneven respone to interrupt command

  1. Analog read with a prescaler set to 16: 104 microseconds (and I have two of them)
  2. LCD write with 4bit: takes more than 20 microseconds as well

Both single functions are far to slow to "wait" for the trigger

You do them after the pulse, as far as I can see you have nearly 5mS, you could spell check War and Peace in that time :slight_smile:

Your psuedo code still uses attachInterrupt() right away you are behind the 8 ball with regard to latency and jitter. It never puts pin13 low and "jumps" to calculate_only_once_after_interrupt which you really can't (or shouldn't) do in C.

Am I correct in saying that the width of the pulse doesn't matter? That seems to be the case because you invoke that huge calculate function from inside the ISR.

I think you are doing the same as I did but still using interrupts and it's the interrupts that are the root of the problem.


Rob