<?xml version="1.0" encoding="UTF-8"?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Arduino Interrupts</title>
	<atom:link href="http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/</link>
	<description>Microcontrollers Electronics Hobby</description>
	<lastBuildDate>Sun, 28 Mar 2010 03:07:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jin</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-870</link>
		<dc:creator>Jin</dc:creator>
		<pubDate>Thu, 01 Jan 2009 06:22:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-870</guid>
		<description>I&#039;ve also instrumented the loop to sample max latency as well as the average. Doing the exact same instructions every loop, I see a max latency of 22-27, with the average between 6 and 9. Why such variability? It&#039;s doing nothing but reading the PIND register. Maybe the main loop&#039;s Serial prints are interfering with the register interrupts and that&#039;s being recorded? If latency is &gt; 256-timerLoadValue, won&#039;t the next interrupt happen at a somewhat random interval?</description>
		<content:encoded><![CDATA[<p>I&#8217;ve also instrumented the loop to sample max latency as well as the average. Doing the exact same instructions every loop, I see a max latency of 22-27, with the average between 6 and 9. Why such variability? It&#8217;s doing nothing but reading the PIND register. Maybe the main loop&#8217;s Serial prints are interfering with the register interrupts and that&#8217;s being recorded? If latency is &gt; 256-timerLoadValue, won&#8217;t the next interrupt happen at a somewhat random interval?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jin</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-869</link>
		<dc:creator>Jin</dc:creator>
		<pubDate>Thu, 01 Jan 2009 05:29:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-869</guid>
		<description>I don&#039;t think your load calculation in the code is correct (it is different from the explanation you give in the text). You are treating timerLoadValue as if it were the total length of time available between interrupts, but shouldn&#039;t it be 256-timerLoadValue? If latency is 20 and timerLoadValue is 200, your could would report 10% load, when it should be 36%.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think your load calculation in the code is correct (it is different from the explanation you give in the text). You are treating timerLoadValue as if it were the total length of time available between interrupts, but shouldn&#8217;t it be 256-timerLoadValue? If latency is 20 and timerLoadValue is 200, your could would report 10% load, when it should be 36%.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dane</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-868</link>
		<dc:creator>Dane</dc:creator>
		<pubDate>Fri, 14 Nov 2008 20:25:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-868</guid>
		<description>How do I use a interrupt on an arduino for converting a pitch into a programmed colored LED. I am using several different colors.</description>
		<content:encoded><![CDATA[<p>How do I use a interrupt on an arduino for converting a pitch into a programmed colored LED. I am using several different colors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: achterwerk</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-867</link>
		<dc:creator>achterwerk</dc:creator>
		<pubDate>Thu, 28 Feb 2008 23:02:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-867</guid>
		<description>Thanks for pointing me in the right direction.
From your code I worked towards a squarewave oscillator running on the compare interrupt of timer1. The difference is that I used the compare mode of the Timer instead of resetting the counter by the program. It is running stable with a sample rate of 44,1 kHz with the rimer running at 16 MHz driving 6 IO Pins connected to an R2R-DAC. According to my tuner the frequency of the oscillator is quite exact and stable over a wide range. But still some coding to do towards a small synthesizer.

Thanks a lot.

Hecke</description>
		<content:encoded><![CDATA[<p>Thanks for pointing me in the right direction.<br />
From your code I worked towards a squarewave oscillator running on the compare interrupt of timer1. The difference is that I used the compare mode of the Timer instead of resetting the counter by the program. It is running stable with a sample rate of 44,1 kHz with the rimer running at 16 MHz driving 6 IO Pins connected to an R2R-DAC. According to my tuner the frequency of the oscillator is quite exact and stable over a wide range. But still some coding to do towards a small synthesizer.</p>
<p>Thanks a lot.</p>
<p>Hecke</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dfowler</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-866</link>
		<dc:creator>dfowler</dc:creator>
		<pubDate>Sun, 27 Jan 2008 23:04:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-866</guid>
		<description>Steve,

Are you still having problems? Maybe I can look at your code to see what&#039;s wrong. You can send it to dfowler@uchobby.com It maybe a few days before I can look at it.

David</description>
		<content:encoded><![CDATA[<p>Steve,</p>
<p>Are you still having problems? Maybe I can look at your code to see what&#8217;s wrong. You can send it to <a href="mailto:dfowler@uchobby.com">dfowler@uchobby.com</a> It maybe a few days before I can look at it.</p>
<p>David</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dfowler</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-865</link>
		<dc:creator>dfowler</dc:creator>
		<pubDate>Sun, 27 Jan 2008 21:49:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-865</guid>
		<description>xSmurf,

Yes, it is described in the article on PWM sound generation at the link below.
http://www.uchobby.com/index.php/2008/01/01/pwm-sound-generation/

The source code is on the Arduino playground and runs the PWM at about 60Khz. It should be easy to change this to meet your needs.</description>
		<content:encoded><![CDATA[<p>xSmurf,</p>
<p>Yes, it is described in the article on PWM sound generation at the link below.<br />
<a href="http://www.uchobby.com/index.php/2008/01/01/pwm-sound-generation/" rel="nofollow">http://www.uchobby.com/index.php/2008/01/01/pwm-sound-generation/</a></p>
<p>The source code is on the Arduino playground and runs the PWM at about 60Khz. It should be easy to change this to meet your needs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xSmurf</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-864</link>
		<dc:creator>xSmurf</dc:creator>
		<pubDate>Sun, 27 Jan 2008 20:39:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-864</guid>
		<description>Is it possible to change the duty cycle at a specific frequency to use this for fast PWM? I&#039;m looking into building a switching led driver and need to generate a 33% duty cycle at 13Khz using the internal osc. at 8Mhz.</description>
		<content:encoded><![CDATA[<p>Is it possible to change the duty cycle at a specific frequency to use this for fast PWM? I&#8217;m looking into building a switching led driver and need to generate a 33% duty cycle at 13Khz using the internal osc. at 8Mhz.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Hobley</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-863</link>
		<dc:creator>Steve Hobley</dc:creator>
		<pubDate>Thu, 24 Jan 2008 13:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-863</guid>
		<description>Hi,

I&#039;ve been trying to set the prescaler to /32 but the timer no longer fires when I set the LSB to 0,1,1 - when I set them to 1,0,0 (/64) it works OK.

// Set to /64

TCCR2B &#124;=    (1</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;ve been trying to set the prescaler to /32 but the timer no longer fires when I set the LSB to 0,1,1 &#8211; when I set them to 1,0,0 (/64) it works OK.</p>
<p>// Set to /64</p>
<p>TCCR2B |=    (1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dfowler</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-862</link>
		<dc:creator>dfowler</dc:creator>
		<pubDate>Tue, 22 Jan 2008 22:43:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-862</guid>
		<description>JMG,

You are correct, if the timer autoloaded then you probably would not need to correct for latency. There are some cases where the processor could have been delayed getting to the ISR due to interrupts being disabled. The correction method above would maintain the average timing where the autoload would tend to have longer times on average.

The real reason that I use the latency trick above is to measure the load my ISR is putting on the uC. Once you have the few instructions required to do the load process it really is not a big problem and the benefit is that you can always measure latency and/or the ISR load. This is especially useful when you are developing the ISR code with a fast timing cycle.</description>
		<content:encoded><![CDATA[<p>JMG,</p>
<p>You are correct, if the timer autoloaded then you probably would not need to correct for latency. There are some cases where the processor could have been delayed getting to the ISR due to interrupts being disabled. The correction method above would maintain the average timing where the autoload would tend to have longer times on average.</p>
<p>The real reason that I use the latency trick above is to measure the load my ISR is putting on the uC. Once you have the few instructions required to do the load process it really is not a big problem and the benefit is that you can always measure latency and/or the ISR load. This is especially useful when you are developing the ISR code with a fast timing cycle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JMG</title>
		<link>http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/comment-page-1/#comment-861</link>
		<dc:creator>JMG</dc:creator>
		<pubDate>Tue, 22 Jan 2008 17:54:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/#comment-861</guid>
		<description>Thanks so much for the fantastic tutorial! You do a great service for the hobbyist community, not only by posting this information, but by responding so diligently to comments!

One thing I&#039;m not sure I understand, though, is the need to correct for the timer load and ISR latency. Wouldn&#039;t this need be obviated if the timer reset itself automatically? Do you simply do the manual measuring in specific example, because you want to measure what the load and latency are, or is there more to it than that?</description>
		<content:encoded><![CDATA[<p>Thanks so much for the fantastic tutorial! You do a great service for the hobbyist community, not only by posting this information, but by responding so diligently to comments!</p>
<p>One thing I&#8217;m not sure I understand, though, is the need to correct for the timer load and ISR latency. Wouldn&#8217;t this need be obviated if the timer reset itself automatically? Do you simply do the manual measuring in specific example, because you want to measure what the load and latency are, or is there more to it than that?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
