Electronics > Microcontrollers

Interrupts and encoders

(1/3) > >>

MikeJuszkie:
I am trying to get a Arduino project up and running.  I did not have the interrupts because the program was small enough where it did not matter. Now I am looking to expand so I attached them as interrupts and the encoders are not working anymore. do they require hardware debounceing?

nctnico:
Yes. Its better to use a timer interrupt to read the encoder inputs at a specific interval. Perhaps do some filtering in software as well (for example: input low/high for at least 3 interrupt periods).

mazurov:
Here's a couple of articles from my blog about reading rotary encoders with Arduino using lookup table method. This method does not require debouncing. Both polling and interrupt are demonstrated:

http://www.circuitsathome.com/mcu/reading-rotary-encoder-on-arduino
http://www.circuitsathome.com/mcu/rotary-encoder-interrupt-service-routine-for-avr-micros

Teemo:
It seems logical to me to use "interrupt on change" to read encoder, instead of timer interrupt.

mamalala:

--- Quote from: Teemo on January 09, 2013, 05:13:56 pm ---It seems logical to me to use "interrupt on change" to read encoder, instead of timer interrupt.

--- End quote ---

The problem is a lack of debouncing. The IRQ will trigger several times due to contact bouncing. It makes the routine more complex, and thus more time consuming. Using a timer IRQ is simpler.

Greetings,

Chris

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod