Encoder interrupts Why?

A lot of encoder programs use interrupts.

My robot arm has six axis with encoders. A/b pulse, index and a home position switch.

Anyone know of an example program for 6 axis I could look at?

What I read already. But don’t understand it.

“ If you wanted to ensure that a program always caught the pulses from a rotary encoder, so that it never misses a pulse, it would make it very tricky to write a program to do anything else, because the program would need to constantly poll the sensor lines for the encoder, in order to catch pulses when they occurred”

To ensure any of the sensor transitions will not be missed.

If pulses come too often for polling, interrupts may be necessary. Like for monitoring speed and/or position of a motor.

For a manually actuated encoder and well written code, interrupts are not necessary.

Using interrupts does not guarantee that you won't miss a pulse, and may not work at all, especially with a slow, 16MHz Arduino and 12 interrupt sources (six encoders each with A&B outputs).

Here is a good article detailing the difficulties when using encoders and the different methods to solve them: TronicsBench: Rotary Encoder

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.