<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: External Interrupts not working?</title>
		<link>http://forums.leaflabs.com/topic.php?id=593</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:15:17 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=593" rel="self" type="application/rss+xml" />

		<item>
			<title>mikep on "External Interrupts not working?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=593#post-3324</link>
			<pubDate>Fri, 07 Jan 2011 15:56:17 +0000</pubDate>
			<dc:creator>mikep</dc:creator>
			<guid isPermaLink="false">3324@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok, thank you, I see that sentence now.&#60;br /&#62;
So the documentation above seems to just be a little bit out of date where it says: &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;Parameters

    * channel - the channel to attach the ISR to, from 1 to 4.
    * handler - The ISR to attach to the given channel.&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;It's nice that libmaple does all the translation from PIN to the ISR for us.&#60;br /&#62;
Thanks again,&#60;br /&#62;
Mike
&#60;/p&#62;</description>
		</item>
		<item>
			<title>General Tree on "External Interrupts not working?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=593#post-3322</link>
			<pubDate>Fri, 07 Jan 2011 15:10:09 +0000</pubDate>
			<dc:creator>General Tree</dc:creator>
			<guid isPermaLink="false">3322@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#34;On the Maple, you don’t have to remember which interrupt number goes with which pin – just tell attachInterrupt() the pin you want.&#34; (quote from &#60;a href=&#34;http://leaflabs.com/docs/lang/api/attachinterrupt.html#id3&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/lang/api/attachinterrupt.html#id3&#60;/a&#62; )&#60;/p&#62;
&#60;p&#62;This means that if you want to attach an interrupt to pin #2, you need to write&#60;/p&#62;
&#60;p&#62;attachInterrupt(2,handler,CHANGE);&#60;/p&#62;
&#60;p&#62;regardless of the EXTIx channel the pin is connected to (for this pin, its EXTI0).&#60;br /&#62;
However, it means that once you attached an interrupt to pin #2, you can not attach an external interrupt to pins 15 and 27, since they too share the EXTI0 channel.&#60;/p&#62;
&#60;p&#62;As for the example, what it does is it reads the state on pin #0 and turns on/off the led on pin #13 accordingly. It would be pointless to attach the interrupt to pin #13, and then change pin #13 according to itself.&#60;br /&#62;
I hope that cleared things a bit.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mikep on "External Interrupts not working?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=593#post-3318</link>
			<pubDate>Fri, 07 Jan 2011 12:22:54 +0000</pubDate>
			<dc:creator>mikep</dc:creator>
			<guid isPermaLink="false">3318@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I am not clear on why the call to attachInterrupt needs to be changed from &#34;0&#34; to &#34;analogInPin&#34;?&#60;br /&#62;
I was looking at the documentation for &#34;attachInterrupt&#34; &#60;a href=&#34;http://leaflabs.com/docs/lang/api/attachinterrupt.html&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/lang/api/attachinterrupt.html&#60;/a&#62; and it seems a bit confusing to me.&#60;br /&#62;
First, the documentation of the method signature only lists 2 parameters, not three.&#60;br /&#62;
Also, it talks about valid values from 0 to 4 for the first parameter (channel).&#60;br /&#62;
How does one know which &#34;channel&#34; belongs to which Pin?&#60;br /&#62;
Or is a channel the same as an EXTI line, and we can use this document here to determine which channel to use with which pin:&#60;br /&#62;
&#60;a href=&#34;http://leaflabs.com/docs/external-interrupts.html#external-interrupts&#34; rel=&#34;nofollow&#34;&#62;http://leaflabs.com/docs/external-interrupts.html#external-interrupts&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;So that document says that Pin2 would actually be EXTI0 (channel 0)?&#60;br /&#62;
The example uses channel 0 for Pin13, so that is different too.&#60;/p&#62;
&#60;p&#62;Or is the attachInterrupt method actually translating the pin number into the appropriate channel etc or am I completely looking at this the wrong way?&#60;/p&#62;
&#60;p&#62;Thanks for any insights...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>perry on "External Interrupts not working?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=593#post-3294</link>
			<pubDate>Tue, 04 Jan 2011 19:39:32 +0000</pubDate>
			<dc:creator>perry</dc:creator>
			<guid isPermaLink="false">3294@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;hi,&#60;/p&#62;
&#60;p&#62;change attachInterrupt (0, handler, RISING) to:&#60;/p&#62;
&#60;p&#62;attachInterrupt (analogInPin, handler, RISING);
&#60;/p&#62;</description>
		</item>
		<item>
			<title>doctorzaius on "External Interrupts not working?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=593#post-3280</link>
			<pubDate>Sun, 02 Jan 2011 17:35:16 +0000</pubDate>
			<dc:creator>doctorzaius</dc:creator>
			<guid isPermaLink="false">3280@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I think the external interrupts on my maple aren't working and this is why: &#60;/p&#62;
&#60;p&#62;1) I connected pin 2 and pin 9.&#60;/p&#62;
&#60;p&#62;2) I wrote a program that installs an interrupts handler for pin 2 and generates a square wave using pin 9.&#60;/p&#62;
&#60;p&#62;3) when the program runs, the interrupt handler never gets invoked. The same program works on my Arduino UNO. Here it is:&#60;/p&#62;
&#60;p&#62;/*&#60;br /&#62;
 * Interrupt test&#60;br /&#62;
 */&#60;/p&#62;
&#60;p&#62;const int analogOutPin = 9; //Pin 9 and Pin 2 are wired together.&#60;br /&#62;
const int analogInPin = 2;&#60;/p&#62;
&#60;p&#62;volatile int count = 0;&#60;/p&#62;
&#60;p&#62;void setup()&#60;br /&#62;
{&#60;br /&#62;
  pinMode (analogOutPin, OUTPUT);&#60;br /&#62;
  pinMode (analogInPin, INPUT);&#60;br /&#62;
  attachInterrupt (0, handler, RISING);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void handler ()&#60;br /&#62;
{&#60;br /&#62;
  count++;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
  digitalWrite (analogOutPin, HIGH);&#60;br /&#62;
  delay (50);&#60;br /&#62;
  digitalWrite (analogOutPin, LOW);&#60;br /&#62;
  delay (50);&#60;br /&#62;
  SerialUSB.print (count);&#60;br /&#62;
  SerialUSB.print (&#34;\n&#34;);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;What am I doing wrong?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
