edward0429 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Leonardo Interrupts not working #714

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
int pin = 13;
volatile int state = LOW;

void setup()
{
pinMode(pin, OUTPUT);
attachInterrupt(0, blink, CHANGE);
}

void loop()
{
digitalWrite(pin, state);
}

void blink()
{
state = !state;
}

What is the expected output? What do you see instead?
LED on pin should light when D0 state is changed

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?
Arduino 1.0 rc2
Windows 7 x64
Adafruit 32u4 breakout

Please provide any additional information below.
I can programme over USB or SPI, basic blink program works fine, just no 
interrupts work

Original issue reported on code.google.com by nathan.o...@gmail.com on 15 Nov 2011 at 10:17

GoogleCodeExporter commented 8 years ago
Looks like interrupts haven't been implemented for Leonardo yet--it would be 
great if this could get fixed in the near future. The following macros are not 
implemented in pins_arduino.h:

#define digitalPinToPCICR(p)
#define digitalPinToPCICRbit(p)
#define digitalPinToPCMSK(p)   
#define digitalPinToPCMSKbit(p)

If I get the time to work on these macros for the m32u4, I'll submit a patch.

Original comment by ethanzo...@gmail.com on 22 Jan 2012 at 1:32

GoogleCodeExporter commented 8 years ago
Arduino Leonardo R3.
Ubuntu 12.04, Arduino IDE 1.0.1.

Program functionally identical to one in the original post does work, but 
documentation [1] for the interrupt mapping seems to be wrong:

Interrupt 0 seems to work on PIN 3, NOT PIN 2 as advertised.
Interrupt 1 seems to work on PIN 2, NOT PIN 3 as advertised.

I have not attempted to determine if this is a documentation bug or an 
implementation bug.

[1] http://arduino.cc/en/Reference/AttachInterrupt

Original comment by steven12...@hotmail.co.uk on 1 Jul 2012 at 4:27

GoogleCodeExporter commented 8 years ago
Zach, can you take a look?  Do we have the interrupts for the Leonardo switched 
(relative to the Uno)?

Original comment by dmel...@gmail.com on 31 Jul 2012 at 12:29

GoogleCodeExporter commented 8 years ago

Original comment by dmel...@gmail.com on 5 Sep 2012 at 2:19

GoogleCodeExporter commented 8 years ago
the interrupts are now implemented and working.
Int0 on D3, In1 on D2, Int2, on D0, Int3 on D1

Original comment by f.vanz...@gmail.com on 16 Apr 2013 at 8:18

GoogleCodeExporter commented 8 years ago
http://arduino.cc/en/Reference/attachInterrupt shows pin 7 as interrupt 4 for 
the Leonardo (one of 5 hardware interrupts).  But 
http://www.atmel.com/Images/7766s.pdf shows int.6. for port-pin E-6.  And the 
above shows just 4 interrupts...

Documentations needs clarifying as to what hardware interrupts the Leonardo 
has, on what interrupt numbers.  

Original comment by pwbec...@hotmail.com on 21 Aug 2013 at 11:58