Go Down

Topic: Using multiple hardware interrupts on ATTiny84 (Read 49 times) previous topic - next topic

bratan

I want to build small RF remote that works off 3V coin cell. ATTiny84 seems like a good candidate. To save battery power, IC will be sleeping, only being awakened by external interrupt (button).  Problem is I want to use several buttons. From pinout it looks like ATTiny84 has at least 10 usable hardware interrupts (wow that a lot more than ATMega328p) if I'm reading it correctly.  Would I be able to wake chip if by several buttons that attached to those pins?  Also how do you debounce those buttons, since millis is not working in ISR function?
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

fungus

#1
Oct 22, 2014, 06:16 pm Last Edit: Oct 22, 2014, 06:18 pm by fungus
I want to build small RF remote that works off 3V coin cell. ATTiny84 seems like a good candidate. To save battery power, IC will be sleeping, only being awakened by external interrupt (button).  Problem is I want to use several buttons. From pinout it looks like ATTiny84 has at least 10 usable hardware interrupts (wow that a lot more than ATMega328p) if I'm reading it correctly.  Would I be able to wake chip if by several buttons that attached to those pins?  Also how do you debounce those buttons, since millis is not working in ISR function?
ATMega328 can interrupt on any pin but 2 pins are special because they have their onw interrupt vector.

The Tiny84 is similar, it can interrupt on any pin but pin 5 (PB2) is special, it has its own interrupt vector (INT0). Unfortunately, this is the only pin that can wake up the chip when it's sleeping.

millis() should work in an interrupt (it just reads the value) but if millis isn't working for some reason then you need another time source for debounce. Use whatever is available... :-)
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Riva

Can you use double pole/double terminal switch so one terminal goes to the hardware interrupt pin and the other to the normal pin for button reading.
You might also be able to use single terminal switches connected to both the button pin and the hardware interrupt pin via diodes to stop volts going back to other switches.
http://forum.arduino.cc/index.php?action=unread;boards=5,67,10,11,66,12,15,17,21,22,23,24,25,29;ALL

fungus

You might also be able to use single terminal switches connected to both the button pin and the hardware interrupt pin via diodes to stop volts going back to other switches.
Yep, diodes should work ... connect every switch to its input pin then connect each pin to the wake up pin via a diode (one per pin).


No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

justone

The Tiny84 is similar, it can interrupt on any pin but pin 5 (PB2) is special, it has its own interrupt vector (INT0). Unfortunately, this is the only pin that can wake up the chip when it's sleeping.
Are you sure about this? From the datasheet.

Pin change interrupts on PCINT11..0 are detected asynchronously.
This implies that these interrupts can be used for waking the part also from sleep
modes other than Idle mode.

Coding Badly


Pin change interrupts do wake a sleeping AVR processor.  Even a t84.

Go Up