Uneven respone to interrupt command

That does not work for me. Think about:

  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 functoins are far to slow to "wait" for the trigger

What I did was the following

Pseudocode


setup
attachInterrupt

loop
{
do-other-things
}

function Interrupt action
put PIN13->high
jump to calculate_only_once_after_interrupt


function calculate_only_once_after_interrupt
calculatecalculatecalculatecalculatecalculate


function do-other-things
x=x+1
if x==8->x=1

if x=1
If the last LCD write was more than 25mS away-> write LCD
if x=2
read analog1

if x=2
read analog2

.
.
.

if x=8
write Pinxyz HIGH

The function do-other-things will lead to do one action out of 8 when called. That ensures proper execution of each function.