Go Down

Topic: How to avoid interrupt priority (Read 217 times) previous topic - next topic

Tanvesh111

Hi, I'm using two interrupts (interrupt 0, interrupt 1), interrupt 0 handler is getting executed bcoz of its first priority while interrupt 1 is not triggered.
Pls give me a solution so that both the interrupt tasks works simultaneously or with micro seconds delay.
THANKS .

Grumpy_Mike

Quote
Pls give me a solution so that both the interrupt tasks works simultaneously
That is not possible.

Quote
or with micro seconds delay
If both interrupts are triggered at the same time the one with top priority will go first. When it finishes the second one will run. You don't have to do anything special to make this happen, it happens automatically.

Tanvesh111


That is not possible.

Any solution. Actually I'm working with optical encoders.
So i need a solution so that both motors starts simultaneously and count the rotations at same time.

AWOL

Feel free to clue us in - you know, with details and stuff.

We're not psychic.

Grumpy_Mike

#4
Aug 11, 2018, 12:53 pm Last Edit: Aug 11, 2018, 12:55 pm by Grumpy_Mike
That is not possible.

Any solution. Actually I'm working with optical encoders.
Then if you think you need both interrupt service routines to work at the same time then your project is stuffed and so go and think of something else.

Quote
So i need a solution so that both motors starts simultaneously and count the rotations at same time.
But they don't need to work at the same time, they need to both run in the time between pulses from your encoder.

cattledog

Quote
So i need a solution so that both motors starts simultaneously and count the rotations at same time.
Quote
or with micro seconds delay.
Can you please explain more about the motor synchronization you need? What are the motors doing and at what speed?

pjrc

Maybe use the Encoder library?  Maybe start with its "TwoKnobs" example...

johnwasser

It sound like you have too much code in your interrupt handlers or you are getting another Int0 interrupt before the Int0 handler returns.  If the interrupt rate is in the millions per second you may need faster hardware.  They do make quadrature counter chips.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up