Electronics > Beginners

Atmel external interrupt and rotary encoder

<< < (3/4) > >>

Kasper:
Instead of a diode and an or gate maybe some FETs.

Dave:
An XOR will always change its output state regardless of which pin changes first.

Zanshin:
Dave - thanks, I had neglected to think that a quadrature only changes one pin at a time and only though about the end state. With the 2 pins going through an XOR and the Atmel external interrupt hooked up to that I would get a pin-change event regardless of the initial state of the encoder pins and that would wake up the device. In addition, I'd only need that small XOR chip and wouldn't need to add a diode to the PCB. Plus it is a cheap solution at under $0.06 in bulk.

mvs:

--- Quote from: Zanshin on November 14, 2018, 04:31:17 pm ---@MasterT
Thanks for code post, but I'm already using similar code in my own library (see link above). Unfortunately many Atmega processors such as the ATMega168 or ATMega 328 only have 2 external interrupt pins that can wake the processor from deep sleep.

--- End quote ---
Atmega 168 and 328 have not only 2 External Interrupts (INT0, INT1), but also Pin Change Interrupts PCI0-PCI2 that are wired to all digital pins (PCINT0-PCINT23).

Kleinstein:
If the encoder is for manual control (the push bottom suggests this) one could use just one of the lines for wake up. Depending on the way you look at the decoder one would loose some resolution and might get some rare glitches.

The suitable logical function would be an xor to get a signal change on any movement. However the extra power consumption and pin count might be a problem.

There are more interrupts via pin change interrupt. Another option is the ICP function - though it does not work with all power saving modes.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

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