NASAZach:
We're logging data from an encoder along with the time each data point is recorded. When processing for V = d/dt and then A = dv/dt, the dt array values should be constant if we are truly taking data at constant intervals. Sometimes the spacing is 1 ms, sometimes 2 ms. Double the dt means half the velocity, and we get outliers in the data set.
You might want to look at this:
I was timing intervals fairly precisely in the sketch there.
We'd like to avoid the outliers since they are manifested by timing issues of the arduino, and I thought a good way would be to try disabling interrupts so that a predictable and constant amount of time passes between each recorded data. Thoughts of other work arounds?
You can disable interrupts, but there has to be a certain amount of jitter, unless perhaps you put the processor to sleep.
The thing is, if you have a loop, and you are checking for "the event" to be up, the event might be up at some point in the loop, which you won't know.
I had this issue when trying to do VGA graphics, which is highly timing dependent.
In that sketch, I put the processor to sleep, and waited for an interrupt to wake it. Once it is asleep, the time taken to wake it is fixed, and you aren't halfway through some sort of checking loop.
So my suggestion is, use an interrupt to detect the event itself, use micros() as suggested above, and put the processor to sleep to eliminate jitter.
For more help, I suggest you post your code. Virtually every time someone wants to disable interrupts, or enable them inside an ISR, or "jump out" of an interrupt they are describing their low-level solution to a problem, but without stating the problem itself.