Hi there,
I have a timer and an interrupt pin set up as follows:
The interrupt pin is listening to an IEEE-488 attention signal, and after that signal changes state, I must set a different pin to acknowledge the attention within 14us.
Assume I am receiving 100s of attention signals a second, without the timer enabled, this isn't a problem and works all the time. The interrupt goes into the method ATNHandler, I set the pin all good.
But if I enable the timer, occasionally and what seems random (every few seconds) the logic above fails, and the response to the attention signal doesn't occur in time.
I assume ATNHandler isn't being called in time.
I've tried this with no luck:
As I hoped it would cause the timer to not interrupt the pin, so I figure that isn't the issue.
So all I can think of is when it fails, it is currently in the timer code, and it is simply taking too long to service the pin interrupt, i.e. to exit the timer code and service the interrupt.
Doe this sound right?
And if so, any suggestions on how to get around it?
thanks
I have a timer and an interrupt pin set up as follows:
Code:
...
// ATN - Attention Active Low
pinMode(ATNInteruptPin, INPUT_PULLDOWN);
attachInterrupt(digitalPinToInterrupt(ATNInteruptPin), ATNHandler, CHANGE);
myTimer.begin(StatusUpdateTimer, 250000); // run every 0.25 seconds
...
The interrupt pin is listening to an IEEE-488 attention signal, and after that signal changes state, I must set a different pin to acknowledge the attention within 14us.
Assume I am receiving 100s of attention signals a second, without the timer enabled, this isn't a problem and works all the time. The interrupt goes into the method ATNHandler, I set the pin all good.
But if I enable the timer, occasionally and what seems random (every few seconds) the logic above fails, and the response to the attention signal doesn't occur in time.
I assume ATNHandler isn't being called in time.
I've tried this with no luck:
Code:
void ATNHandler()
{
noInterrupts();
if (atn == 0)
{
Attention();
}
interrupts();
}
As I hoped it would cause the timer to not interrupt the pin, so I figure that isn't the issue.
So all I can think of is when it fails, it is currently in the timer code, and it is simply taking too long to service the pin interrupt, i.e. to exit the timer code and service the interrupt.
Doe this sound right?
And if so, any suggestions on how to get around it?
thanks