Author Topic: Arduino interrupts and SPI together  (Read 4513 times)

tsimon57

  • Newbie
  • *
  • Posts: 1
Arduino interrupts and SPI together
« on: September 11, 2012, 02:31:24 pm »
I see that INT0 is shared with an SPI pin.  So using both together will be a problem. The Arduino lib supports INT0 and INT1. There is a HW interrupt for pin transitions. So perhaps another pin can be used for an interrupt. Is there going to be an easy way to code this or do I have to dive into ATtiny registers?
« Last Edit: September 11, 2012, 02:31:24 pm by tsimon57 »

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Arduino interrupts and SPI together
« Reply #1 on: October 03, 2012, 02:14:58 am »
The ATtiny85 chip used on the DigiSpark has one regular interrupt pin (INT0), and one Pin Change interrupt (PCINT0). There is no INT1 on attiny85. The INT0 interrupt pin has some special features, like being able to only fire on low-to-high transitions or vice versa. It\'s also at a higher priority than other interrupts, so if there\'s a conflict, INT0 runs first.

Pin Change interrupt is available in the DigiSpark, but if you need your code to only run when the pin changes from low to high or only when it changes high to low, you need to code that yourself. You can select which pins pcint watches (can be more than one), but again it\'s your own job to figure out which pin caused the interrupt to fire if you watch more than one.