<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hack a Day &#187; programming</title>
	<atom:link href="http://hackaday.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackaday.com</link>
	<description>Fresh hacks every day</description>
	<lastBuildDate>Fri, 10 Feb 2012 12:45:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hackaday.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5560f98f805877b0e332f191cb9e0af3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Hack a Day &#187; programming</title>
		<link>http://hackaday.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hackaday.com/osd.xml" title="Hack a Day" />
	<atom:link rel='hub' href='http://hackaday.com/?pushpress=hub'/>
		<item>
		<title>Programming the 6502 one nibble at a time</title>
		<link>http://hackaday.com/2011/12/07/programming-the-6502-one-nibble-at-a-time/</link>
		<comments>http://hackaday.com/2011/12/07/programming-the-6502-one-nibble-at-a-time/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 22:01:21 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[pcs hacks]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[machine code]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ram]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=62903</guid>
		<description><![CDATA[[Quinn Dunki] keeps rolling with her 6502 based computer build. This time around she&#8217;s added some memory to store the programs, but needed a way to get that code into the device. Above is her solution, a bank of hex switches used to program the 8-bit command and 16-bit address for each line of machine [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=62903&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-62904" title="programming-1-bit-at-a-time" src="http://hackadaycom.files.wordpress.com/2011/12/programming-1-bit-at-a-time-e1323275347282.jpg" alt="" width="470" height="350" /></p>
<p>[Quinn Dunki] keeps rolling with her 6502 based computer build. This time around she&#8217;s added some memory to store the programs, but needed a way to get that code into the device. Above is her solution, <a href="http://quinndunki.com/blondihacks/?p=708">a bank of hex switches used to program</a> the 8-bit command and 16-bit address for each line of machine code.</p>
<p>This is a continuation of her Veronica project. The last time we saw it <a href="http://hackaday.com/2011/11/30/building-a-computer-around-a-6502-processor/">she had hardwired the logic levels for the data bus</a>, but that&#8217;s no fun since nothing can actually be computed. [Quinn] picked up an SRAM chip which will store the program. It&#8217;s compatible with the 6502&#8242;s memory bus, but needs a bit of extra circuitry for her to be able to hand program it with this switch bank. She used some tri-state buffers to switch between connections to the processor, and to the hex switches. This way, she disconnects the RAM from the processor using the buffers, uses the switches and push button to clock in the program, then patches the RAM back into the computer.</p>
<p>Seeing this process in the video after the break certainly gives you an appreciation for what an improvement the punch-card system was over this technique. Still, seeing this is a delight that we&#8217;d like to try!<span id="more-62903"></span><span style="text-align:center; display: block;"><a href="http://hackaday.com/2011/12/07/programming-the-6502-one-nibble-at-a-time/"><img src="http://img.youtube.com/vi/XsKTWK7prIA/2.jpg" alt="" /></a></span></p>
<br />Filed under: <a href='http://hackaday.com/category/misc-hacks/'>misc hacks</a>, <a href='http://hackaday.com/category/pcs-hacks/'>pcs hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/62903/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/62903/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/62903/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/62903/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/62903/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/62903/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/62903/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/62903/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=62903&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/12/07/programming-the-6502-one-nibble-at-a-time/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/12/programming-1-bit-at-a-time-e1323275347282.jpg" medium="image">
			<media:title type="html">programming-1-bit-at-a-time</media:title>
		</media:content>
	</item>
		<item>
		<title>The International Obfuscated C Code Contest is back</title>
		<link>http://hackaday.com/2011/11/14/the-international-obfuscated-c-code-contest-is-back/</link>
		<comments>http://hackaday.com/2011/11/14/the-international-obfuscated-c-code-contest-is-back/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 18:01:36 +0000</pubDate>
		<dc:creator>Brian Benchoff</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[c programming]]></category>
		<category><![CDATA[IOCCC]]></category>
		<category><![CDATA[obfuscated c code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=61188</guid>
		<description><![CDATA[The International Obfuscated C Code Contest is back. The stated goals of the IOCCC are to, “Write the most obscure C program, show the importance of programming style (by doing the opposite), stress the preprocessor to the breaking point, and illustrate some subtleties of the C language.” If you think you’re up to the task [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=61188&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-61189" title="IOCC" src="http://hackadaycom.files.wordpress.com/2011/11/iocc.png" alt="" width="470" height="60" /></p>
<p>The <a href="http://www.ioccc.org/">International Obfuscated C Code Contest</a> is back. The <a href="http://www.ioccc.org/index.html#goals">stated goals</a> of the IOCCC are to, “Write the most obscure C program, show the importance of programming style (by doing the opposite), stress the preprocessor to the breaking point, and illustrate some subtleties of the C language.” If you think you’re up to the task of abusing your compiler, check out the <a href="http://www.ioccc.org/2011/rules.txt">rules</a> and <a href="http://www.ioccc.org/2011/guidelines.txt">guidelines</a> for the contest.</p>
<p>There’s nothing quite like having the <a href="http://www.ioccc.org/1998/banks.c">code for a flight simulator</a> look like a plane, or calculating pi by measuring the area of C code. The submissions to the IOCCC are classic hacks; very clever things that shouldn’t work, but do despite themselves.</p>
<p>There hasn’t been an IOCCC competition since 2006, and no one knows if it will be around next year. We’ve already seen a few potential entries for this year, like <a href="http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/">piping chars into /dev/audio</a> to generate a song and <a href="http://hackaday.com/2011/07/12/zzstructure-emulator/">hyperlinks all the way down</a>. If you’ve got something you’re working on, feel free to <a href="http://hackaday.com/contact-hack-a-day/">send it in</a>.</p>
<p>via <a href="http://developers.slashdot.org/story/11/11/13/1546218/the-ioccc-competition-is-back">/.</a></p>
<br />Filed under: <a href='http://hackaday.com/category/software-development/'>Software Development</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/61188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/61188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/61188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/61188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/61188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/61188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/61188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/61188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=61188&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/11/14/the-international-obfuscated-c-code-contest-is-back/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">brianbenchoff</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/11/iocc.png" medium="image">
			<media:title type="html">IOCC</media:title>
		</media:content>
	</item>
		<item>
		<title>Annoy your sound guy even more</title>
		<link>http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/</link>
		<comments>http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 23:00:04 +0000</pubDate>
		<dc:creator>Brian Benchoff</dc:creator>
				<category><![CDATA[musical hacks]]></category>
		<category><![CDATA[algorithmic music]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[obfuscated c code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=60170</guid>
		<description><![CDATA[&#8220;I can&#8217;t hear myself in the mix,&#8221; &#8220;yeah, man, I&#8217;ll be there at 8,&#8221; and &#8220;dude, we need like four more mics.&#8221; Each and every one of these words is documented in actuarial tables and doesn&#8217;t bode well for your sound tech&#8217;s risk of a stroke. Luckily, there&#8217;s an even better way to kill your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=60170&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-large wp-image-60171" title="soundman" src="http://hackadaycom.files.wordpress.com/2011/11/soundman.png?w=450&#038;h=177" alt="" width="450" height="177" /></p>
<p>&#8220;I can&#8217;t hear myself in the mix,&#8221; &#8220;yeah, man, I&#8217;ll be there at 8,&#8221; and &#8220;dude, we need like four more mics.&#8221; Each and every one of these words is documented in actuarial tables and doesn&#8217;t bode well for your sound tech&#8217;s risk of a stroke. Luckily, there&#8217;s an <a href="http://shackspace.de/?p=2509">even better way</a> to kill your sound guy and this time, it&#8217;s actually pretty clever.</p>
<p>[@dop3j0e] at the Stuttgart hackerspace Shackspace came up with the Noiseplug. It&#8217;s a very small build that could almost fit into a quarter-inch jack. It&#8217;s all SMD with a tiny <del>(unknown)</del> ATtiny9 microcontroller powered by a watch battery.</p>
<p>The music coming out of the Noiseplug is really interesting. All the code on the microcontroller is a <a href="http://shackspace.de/wiki/doku.php?id=project:algorithmicsoundscapes">one-liner written in C</a>. Similar &#8216;algorithmic chiptune&#8217; programs can be run on any PC: check out <a href="http://www.youtube.com/watch?v=GtQdIYUtAHg&amp;feature=related">these</a> <a href="http://www.youtube.com/watch?v=qlrs2Vorw2Y">three</a> <a href="http://www.youtube.com/watch?v=tCRPUv8V22o">examples</a>.</p>
<p>These potential entries to the <a href="http://www0.us.ioccc.org/main.html">International Obfuscated C Code Contest</a> throw chars into an 8-bit PCM stream. Piping the output of these programs to /dev/audio would generate an actual song &#8211; written entirely in one line of C.</p>
<p>Of course, [@dop3j0e] could have made his Noiseplug a <em>little</em> less annoying, but sound techs are underappreciated for a reason, right?</p>
<p>Check out the Noiseplug in action after the break along with a few one-liner C songs.</p>
<p><span id="more-60170"></span></p>
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/31411308' width='400' height='300' frameborder='0'></iframe></div>
<span style="text-align:center; display: block;"><a href="http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/"><img src="http://img.youtube.com/vi/GtQdIYUtAHg/2.jpg" alt="" /></a></span>
<span style="text-align:center; display: block;"><a href="http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/"><img src="http://img.youtube.com/vi/qlrs2Vorw2Y/2.jpg" alt="" /></a></span>
<span style="text-align:center; display: block;"><a href="http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/"><img src="http://img.youtube.com/vi/tCRPUv8V22o/2.jpg" alt="" /></a></span>
<br />Filed under: <a href='http://hackaday.com/category/musical-hacks/'>musical hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/60170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/60170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/60170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/60170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/60170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/60170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/60170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/60170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=60170&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/11/01/annoy-your-sound-guy-even-more/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">brianbenchoff</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/11/soundman.png?w=450" medium="image">
			<media:title type="html">soundman</media:title>
		</media:content>
	</item>
		<item>
		<title>Ants duke it out in the AI challenge</title>
		<link>http://hackaday.com/2011/10/28/ants-duke-it-out-in-the-ai-challenge/</link>
		<comments>http://hackaday.com/2011/10/28/ants-duke-it-out-in-the-ai-challenge/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 23:01:41 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[ai]]></category>
		<category><![CDATA[artificial in]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=59891</guid>
		<description><![CDATA[All of those orange, cyan, and yellow dots represent digital ants fighting for supremacy. This is a match to see who&#8217;s AI code is better in the Google backed programming competition: The AI Challenge. Before you go on to the next story, take a hard look at giving this a try for yourself. It&#8217;s set [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=59891&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-59892" title="ants-battle-in-AI-challenge" src="http://hackadaycom.files.wordpress.com/2011/10/ants-battle-in-ai-challenge.png" alt="" width="470" height="291" /></p>
<p>All of those orange, cyan, and yellow dots represent digital ants fighting for supremacy. This is a match to see who&#8217;s AI code is better in the Google backed programming competition: <a href="http://aichallenge.org/">The AI Challenge</a>. Before you go on to the next story, take a hard look at giving this a try for yourself. It&#8217;s set up as a way to get more people interested in AI programming, and they claim you can be up and running in just five minutes.</p>
<p>Possibly the best part of the AI Challenge is the resources they provide. The starter kits offer example code as a jumping off point in 22 different programming languages. And a quick start tutorial will help to get you thinking about the main components involved with Artificial Intelligence coding.</p>
<p>The game consists of ant hills for each team, water as an obstacle, and food collection as a goal. The winner is determined by who destroyed more enemy ant hills, and gathered more resources. It provides some interesting challenges, like how to search for food and enemy ant hills, how to plot a path from one point to another, etc. But if you&#8217;re interested in video game programming or robotics, the skills you learn in the process will be of great help later in your hacking exploits.</p>
<br />Filed under: <a href='http://hackaday.com/category/misc-hacks/'>misc hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/59891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/59891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/59891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/59891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/59891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/59891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/59891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/59891/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=59891&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/10/28/ants-duke-it-out-in-the-ai-challenge/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/10/ants-battle-in-ai-challenge.png" medium="image">
			<media:title type="html">ants-battle-in-AI-challenge</media:title>
		</media:content>
	</item>
		<item>
		<title>Program an Arduino using your sound card</title>
		<link>http://hackaday.com/2011/09/09/program-an-arduino-using-your-sound-card/</link>
		<comments>http://hackaday.com/2011/09/09/program-an-arduino-using-your-sound-card/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 19:06:41 +0000</pubDate>
		<dc:creator>Mike Nathan</dc:creator>
				<category><![CDATA[arduino hacks]]></category>
		<category><![CDATA[digital audio hacks]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wav file]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=55284</guid>
		<description><![CDATA[[Chris] wrote us to share a neat technique he has been using to program the Arduinos he uses in his projects. He likes to build bare bones Arduino clones rather than sacrifice full dev boards, and instead of programming them via traditional means, he is using his computer’s sound card. He builds a simple dead [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=55284&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-55285" title="audioino_programming_arduino_with_sound" src="http://hackadaycom.files.wordpress.com/2011/09/audioino_programming_arduino_with_sound.jpg" alt="audioino_programming_arduino_with_sound" width="470" height="344" /></p>
<p>[Chris] wrote us to share <a href="http://www.hobby-roboter.de/forum/viewtopic.php?f=4&amp;t=128&amp;p=531" target="_blank">a neat technique he has been using to program the Arduinos</a> he uses in his projects. He likes to build bare bones Arduino clones rather than sacrifice full dev boards, and instead of programming them via traditional means, he is using his computer’s sound card.</p>
<p>He builds a simple dead bug Arduino (which he calls an Audioino) using a handful of resistors, a pair of caps, an LED, a reset switch, and most importantly &#8211; an audio jack. After burning <a href="http://www.hobby-roboter.de/forum/viewtopic.php?f=4&amp;t=127" target="_blank">a special audio bootloader</a> to the chip, he can connect the Arduino directly into his computer’s speaker port for programming.</p>
<p>Once the microcontroller is connected to his computer, he runs the IDE-generated hex file through a Java app he created, which converts the data into a WAV file. With the Arduino put into programming mode, he simply plays the WAV file with an audio player, and the code is uploaded.</p>
<p>He says that this method of programming comes in handy in certain cases where he builds things for friends, because they can easily update the software on their own without a lot of fuss.</p>
<br />Filed under: <a href='http://hackaday.com/category/arduino-hacks/'>arduino hacks</a>, <a href='http://hackaday.com/category/digital-audio-hacks/'>digital audio hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/55284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/55284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/55284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/55284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/55284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/55284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/55284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/55284/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=55284&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/09/09/program-an-arduino-using-your-sound-card/feed/</wfw:commentRss>
		<slash:comments>85</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">mikenathanathackaday</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/09/audioino_programming_arduino_with_sound.jpg" medium="image">
			<media:title type="html">audioino_programming_arduino_with_sound</media:title>
		</media:content>
	</item>
		<item>
		<title>Making the case for in-circuit debugging tools</title>
		<link>http://hackaday.com/2011/08/01/making-the-case-for-in-circuit-debugging-tools/</link>
		<comments>http://hackaday.com/2011/08/01/making-the-case-for-in-circuit-debugging-tools/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 16:01:34 +0000</pubDate>
		<dc:creator>Mike Nathan</dc:creator>
				<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[ICD]]></category>
		<category><![CDATA[pic]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=50970</guid>
		<description><![CDATA[If you are in the market for a PIC microcontroller programmer, you may want to consider a model with an In-Circuit Debugger (ICD). [Rajendra] put together a great tutorial on using an ICD when debugging PIC firmware, which makes a pretty convincing argument for owning one. In his tutorial, he happens to be using a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=50970&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-50971" title="in_circuit_debugging_of_pic_microcontrollers" src="http://hackadaycom.files.wordpress.com/2011/08/in_circuit_debugging_of_pic_microcontrollers.jpg" alt="in_circuit_debugging_of_pic_microcontrollers" width="470" height="284" /></p>
<p>If you are in the market for a PIC microcontroller programmer, you may want to consider a model with an In-Circuit Debugger (ICD). [Rajendra] put together <a href="http://embedded-lab.com/blog/?p=3289" target="_blank">a great tutorial on using an ICD</a> when debugging PIC firmware, which makes a pretty convincing argument for owning one.</p>
<p>In his tutorial, he happens to be using a MikroElektronika PICflash2, but he says that there are plenty of other ICDs out there if you are not keen on this particular model. The PICflash2 not only acts as an ICD, but as the name suggests it works as an ICSP as well.</p>
<p>[Rajendra] walks us through a short debugging session using some simple code that reads data from an LM34DZ temperature sensor, displaying the results on an LCD screen. While he isn&#8217;t actually hunting for bugs, he does show how easy it is to step through the PIC’s code one statement at a time, evaluating variables and registers along the way.</p>
<p>[Rajendra] does point out that using an ICD does occupy a few I/O pins while running, limiting your resources just a bit. We think that being able to debug code as it runs is pretty reasonable tradeoff if you don’t necessarily need each and every pin available for use.</p>
<br />Filed under: <a href='http://hackaday.com/category/microcontrollers/'>Microcontrollers</a>, <a href='http://hackaday.com/category/tool-hacks/'>tool hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/50970/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/50970/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/50970/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/50970/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/50970/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/50970/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/50970/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/50970/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=50970&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/08/01/making-the-case-for-in-circuit-debugging-tools/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">mikenathanathackaday</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/08/in_circuit_debugging_of_pic_microcontrollers.jpg" medium="image">
			<media:title type="html">in_circuit_debugging_of_pic_microcontrollers</media:title>
		</media:content>
	</item>
		<item>
		<title>Official kinect SDK released</title>
		<link>http://hackaday.com/2011/06/16/official-kinect-sdk-released/</link>
		<comments>http://hackaday.com/2011/06/16/official-kinect-sdk-released/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 20:40:58 +0000</pubDate>
		<dc:creator>Brian Benchoff</dc:creator>
				<category><![CDATA[Kinect hacks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Kinect]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=46230</guid>
		<description><![CDATA[Microsoft just released the beta of the Kinect for Windows SDK. Although, &#8220;Microsoft does not condone the modification of its products&#8221; it appears Microsoft have changed their tune and released APIs for C++, C# and Visual Basic seven months after the Kinect was officially hacked. We&#8217;ve seen libraries being developed since the launch of Kinect, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=46230&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-large wp-image-46231" title="kinect" src="http://hackadaycom.files.wordpress.com/2011/06/kinect.png?w=450&#038;h=241" alt="" width="450" height="241" /></p>
<p>Microsoft just released the beta of the <a href="http://research.microsoft.com/en-us/um/redmond/projects/kinectsdk/default.aspx">Kinect for Windows SDK</a>. Although, &#8220;<a href="http://news.cnet.com/8301-13772_3-20021836-52.html">Microsoft does not condone the modification of its products</a>&#8221; it appears Microsoft have changed their tune and released APIs for C++, C# and Visual Basic seven months after the Kinect was officially hacked.</p>
<p>We&#8217;ve seen libraries being developed <a href="http://hackaday.com/2010/11/04/kilobuck-open-kinect-project-prize/">since the launch of Kinect</a>, culminating in the <a href="http://openkinect.org/wiki/Main_Page">OpenKinect</a> project. The Microsoft release covers the same ground as the OpenKinect project, and will hopefully improve on <a href="http://openkinect.org/wiki/Protocol_Documentation#NUI_Audio">attempts to get audio out of the Kinect</a>.</p>
<p>We&#8217;ve seen Kinect hacks run the gamut from <a href="http://hackaday.com/2011/06/04/amazing-3d-telepresence-system/">telepresence</a>, to <a href="http://hackaday.com/2011/06/03/kinect-driven-cart-makes-shopping-a-snap/">robotics</a>, to <a href="http://hackaday.com/2011/03/25/kinect-minecraft-trifecta/">3D modeling</a>, so the Kinect seems like a great tool in the builder&#8217;s arsenal. The Kinect is a wonderful tool, and even though most of the functionality has already been replicated by the open-source community, it&#8217;s nice to know there&#8217;s official support for all the great projects we&#8217;ve seen.</p>
<br />Filed under: <a href='http://hackaday.com/category/kinect-hacks/'>Kinect hacks</a>, <a href='http://hackaday.com/category/software-development/'>Software Development</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/46230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/46230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/46230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/46230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/46230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/46230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/46230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/46230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=46230&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/06/16/official-kinect-sdk-released/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">brianbenchoff</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/06/kinect.png?w=450" medium="image">
			<media:title type="html">kinect</media:title>
		</media:content>
	</item>
		<item>
		<title>LED build monitor helps keep an eye on your servers</title>
		<link>http://hackaday.com/2011/04/12/led-build-monitor-helps-keep-an-eye-on-your-servers/</link>
		<comments>http://hackaday.com/2011/04/12/led-build-monitor-helps-keep-an-eye-on-your-servers/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 21:02:52 +0000</pubDate>
		<dc:creator>Mike Nathan</dc:creator>
				<category><![CDATA[led hacks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[atmega]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=40135</guid>
		<description><![CDATA[In his line of work, Hackaday reader [Pedantite] often has to monitor the build status of several continuous integration servers throughout the day. One afternoon, he got the idea to install a set of stop lights in the office in order to monitor the status of the servers, but filed it away as a &#8220;wouldn&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=40135&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-40136" title="build_status_board" src="http://hackadaycom.files.wordpress.com/2011/04/build_status_board.jpg" alt="build_status_board" width="470" height="352" /></p>
<p>In his line of work, Hackaday reader [Pedantite] often has to monitor the build status of several continuous integration servers throughout the day. One afternoon, he got the idea to install a set of stop lights in the office in order to monitor the status of the servers, but filed it away as a &#8220;wouldn&#8217;t it be cool if&#8230;&#8221; project.</p>
<p>After some time had passed, he was bitten by the idea bug again and decided he would<a href="http://bytecruft.blogspot.com/2011/04/build-system-status-monitor.html" target="_blank"> build a physical device to display the status of his build processes</a>. This time around, he brainstormed on a smaller scale and the result is the &#8220;Indictron&#8221; you see above.</p>
<p>He built a simple LED board made up of four rows of four LEDs to display the build processes. Different LEDs are lit depending on the project&#8217;s current build status as well as the results of the previous build. The board uses an ATmega88, and interfaces with a compiler watchdog application using a virtual USB package made specifically for AVR micro controllers.</p>
<p>The end result is a simple, yet useful status board that &#8220;just works&#8221;. He does not seem to have code or schematics posted on his site at the moment, but we&#8217;re pretty sure he would share them upon request.</p>
<p>If you&#8217;re interested in a bit more of [Pedantite's] work, check out his <a href="http://hackaday.com/2011/04/06/keep-fun-in-check-with-a-parental-count-down-timer/" target="_blank">&#8220;Good Times&#8221; parental timer</a> we featured last week.</p>
<br />Filed under: <a href='http://hackaday.com/category/led-hacks/'>led hacks</a>, <a href='http://hackaday.com/category/software-development/'>Software Development</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/40135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/40135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/40135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/40135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/40135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/40135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/40135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/40135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=40135&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/04/12/led-build-monitor-helps-keep-an-eye-on-your-servers/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">mikenathanathackaday</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/04/build_status_board.jpg" medium="image">
			<media:title type="html">build_status_board</media:title>
		</media:content>
	</item>
		<item>
		<title>Build your own SOIC progamming clip</title>
		<link>http://hackaday.com/2010/11/18/build-your-own-soic-progamming-clip/</link>
		<comments>http://hackaday.com/2010/11/18/build-your-own-soic-progamming-clip/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 18:00:16 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[clip]]></category>
		<category><![CDATA[pci]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=30892</guid>
		<description><![CDATA[[Pyra] was looking for a way to reprogram some ATtiny13 microcontrollers in a SOIC package. He&#8217;s re-engineering some consumer electronics so adding an ISP header to the design isn&#8217;t an option. He had been soldering wires to the legs of every chip but this is quite tedious. What he needs is an adapter that can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=30892&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-30894" title="soic-programming-clips" src="http://hackadaycom.files.wordpress.com/2010/11/soic-programming-clips-e1290096760569.jpg" alt="" width="470" height="353" /></p>
<p>[Pyra] was looking for a way to reprogram some ATtiny13 microcontrollers in a SOIC package. He&#8217;s re-engineering some consumer electronics so adding an ISP header to the design isn&#8217;t an option. He had been soldering wires to the legs of every chip but this is quite tedious. What he needs is an adapter that can make physical contact with the legs just long enough to program new firmware. After looking around he discovered that <a href="http://www.swiatelka.pl/viewtopic.php?t=2178">a PCI socket can be used as a progamming clip</a> (<a href="http://translate.google.com/translate?js=n&amp;prev=_t&amp;hl=en&amp;ie=UTF-8&amp;layout=2&amp;eotf=1&amp;sl=auto&amp;tl=en&amp;u=http://www.swiatelka.pl/viewtopic.php%3Ft%3D2178">translated</a>). It shares the same pitch as a standard SOIC package but is not wide enough for the chip. He cut out 4 rows of the socket and the section of motherboard it was soldered to. Then he made a cut down the middle of the plastic and bent the two sections apart. The image above illustrates this, but not shown are the eight wires that he later added to connect to the device.</p>
<p>We wonder if this can be adapted to program SOIC parts without removing them from a circuit board. That would be a handy tool for finishing up <a href="http://hackaday.com/2010/11/12/help-me-reverse-engineer-an-led-light-bulb/">the LED lightbulb hack</a>.</p>
<br />Filed under: <a href='http://hackaday.com/category/microcontrollers/'>Microcontrollers</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/30892/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/30892/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/30892/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/30892/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/30892/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/30892/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/30892/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/30892/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=30892&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/11/18/build-your-own-soic-progamming-clip/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/11/soic-programming-clips-e1290096760569.jpg" medium="image">
			<media:title type="html">soic-programming-clips</media:title>
		</media:content>
	</item>
		<item>
		<title>AVR Programming 03: Reading and compiling code</title>
		<link>http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/</link>
		<comments>http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 22:00:09 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[bitwise]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[datasheet]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=29460</guid>
		<description><![CDATA[In the last installment of our tutorial series we built a simple circuit on a breadboard and programmed an ATmega168 to make it run. That proves that you know how to follow directions, but the eureka moments of doing everything yourself are on the way. This time around you will get down and dirty with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29460&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-29579" title="avr-programming-for-everyone" src="http://hackadaycom.files.wordpress.com/2010/10/avr-programming-for-everyone.jpg" alt="" width="470" height="150" /></p>
<p>In <a href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/">the last installment</a> of our tutorial series we built a simple circuit on a breadboard and programmed an ATmega168 to make it run. That proves that you know how to follow directions, but the eureka moments of doing everything yourself are on the way. This time around you will get down and dirty with the datasheet, learning where each line of the sample code came from, and give your recently installed compiler a test drive. We will:</p>
<ul>
<li>Talk about bitwise operators and how they work when coding for microcontrollers</li>
<li>Discuss C code shorthand</li>
<li>Review the sample code from Part 2 and talk about what each line of code does</li>
<li>Learn to compile code</li>
</ul>
<p>If this is the first you&#8217;ve heard about our AVR Programming series, head back to <a href="http://hackaday.com/2010/10/23/avr-programming-introduction/">Part 1</a> and start from the beginning. Otherwise, take a deep breath and we&#8217;ll being after the break.</p>
<p><strong>Series roadmap:</strong></p>
<ul>
<li><a title="Permanent Link to AVR Programming 01: Introduction" rel="bookmark" href="http://hackaday.com/2010/10/23/avr-programming-introduction/">AVR Programming 01: Introduction</a></li>
<li><a title="Permanent Link to AVR Programming 01: Introduction" rel="bookmark" href="http://hackaday.com/2010/10/23/avr-programming-introduction/"></a><a title="Permanent Link to AVR Programming 02: The Hardware" rel="bookmark" href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/">AVR Programming 02: The Hardware</a></li>
<li><a title="Permanent Link to AVR Programming 02: The Hardware" rel="bookmark" href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/"></a><a title="Permanent Link to AVR Programming 03: Reading and compiling code" rel="bookmark" href="http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/">AVR Programming 03: Reading and compiling code</a></li>
<li><a href="http://hackaday.com/2010/11/19/avr-programming-04-writing-code-etc/">AVR Programming 04: Writing code</a></li>
</ul>
<p><span id="more-29460"></span></p>
<h2>Prerequisites</h2>
<ul>
<li>You must know something about C code. The ability to read it is probably good enough, Google can help you with the rest as you learn.</li>
<li>It helps if you have a text editor that includes syntax highlighting. I&#8217;m purely a Linux user and I like to use both Kate and Gedit depending on my mood. But I also use nano from the shell quite frequently. This is a tool and your choice is purely personal preference.</li>
<li>Grab <a href="https://github.com/szczys/had_AVRtut_2/archives/master">the sample code from part 2</a> of the series. I&#8217;ve embedded it below but you may want it in a separate windows for reference.</li>
<li>Datasheets; the instruction manual for hardware. Grab <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf">the datasheet for the ATmega168</a> as I&#8217;ll be referencing specific pages as examples. Knowing how to look up information in the datasheet and turn it into code will make it easy for you to use any chip in the AVR family.</li>
</ul>
<h2>Bitwise Operators</h2>
<p>Even though we&#8217;ll be writing code in the C language, we&#8217;re quite close to the hardware when programming microcontrollers. Because of this <strong>you must understand bitwise operators</strong>. Not just kind of, not intuitively, you should know them well enough to teach them to someone else without looking it up.</p>
<p>Hands down the best explanation I&#8217;ve ever come across is by [Eric Weddington], who also co-authored the makefile that came with my example code. It is also known as <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;t=37871">Programming 101.</a> Read it, know it, love it. But I&#8217;ll try to give a quick crash course for those to lazy to read his whole lesson.</p>
<div style="padding-left:30px;">
<table border="1">
<tbody>
<tr>
<th>Code Symbol</th>
<th>Logic Function</th>
</tr>
<tr>
<td align="center">|</td>
<td align="center">OR</td>
</tr>
<tr>
<td align="center">&amp;</td>
<td align="center">AND</td>
</tr>
<tr>
<td align="center">~</td>
<td align="center">NOT</td>
</tr>
<tr>
<td align="center">^</td>
<td align="center">XOR</td>
</tr>
<tr>
<td align="center">&lt;&lt;</td>
<td align="center">Shift Left</td>
</tr>
<tr>
<td align="center">&gt;&gt;</td>
<td align="center">Shift Right</td>
</tr>
</tbody>
</table>
</div>
<p>The list above shows all of the code symbols and their logic operation.</p>
<ul>
<li>OR &#8211; true if either or both bits being compared are 1</li>
<li>AND &#8211; true only if both bits being compared are 1</li>
<li>NOT &#8211; results in the opposite of a value (~1 = 0, ~0 = 1)</li>
<li>XOR &#8211; exclusive OR&#8230; true if one bit being compared is 1 but false if neither or both of them are</li>
<li>Shift Left &#8211; moves bits left within a binary number. (1&lt;&lt;0 = 0b0001, 1&lt;&lt;4 = 0b1000)</li>
<li>Shift Right &#8211; moves bits to the right a desired amount (0b1000&gt;&gt;2 = 0b0010)</li>
</ul>
<p>We&#8217;re going to use Shift Left all the time in our code because it&#8217;s a quick way to build a binary number. We&#8217;re <strong>always</strong> working in binary numbers made up of eight bits. Those bits are numbered 0-7 because counting always starts with 0 when it comes to microcontrollers. So if you want to set the fifth bit to a logic high (&#8217;1&#8242;) you would shift &#8217;1&#8242; left by 5:</p>
<pre>1&lt;&lt;5</pre>
<p>This will result in the binary number 0b00100000. If this is child&#8217;s play, move to the next section. If not, read [Eric's] tutorial.</p>
<h2>C Code Shorthand</h2>
<p>I tend to use shorthand in my code as my hands often hurt from too much typing (as they do now). This saves a bit on the old ibuprofen expenditure for the month by allowing me to type less characters to accomplish the same simple assignments. Here&#8217;s a quick table of examples:</p>
<div style="padding-left:30px;">
<table border="1">
<tbody>
<tr>
<th>Traditional Code</th>
<th>Shorthand Equivalent</th>
</tr>
<tr>
<td align="center">value = value + 1;</td>
<td align="center">value += 1;</td>
</tr>
<tr>
<td align="center">value = value &gt;&gt; 1;</td>
<td align="center">value &gt;&gt;= 1;</td>
</tr>
<tr>
<td align="center">value = value &amp; bitMask;</td>
<td align="center">value &amp;= bitMask;</td>
</tr>
<tr>
<td align="center">value = value | bitMask;</td>
<td align="center">value |= bitMask;</td>
</tr>
<tr>
<td align="center">PORTD = PORTD ^ (1&lt;&lt;0);</td>
<td align="center">PORTD ^= (1&lt;&lt;0);</td>
</tr>
</tbody>
</table>
</div>
<p>So basically, if I am setting a variable by using that same variable as the first <a href="http://en.wikipedia.org/wiki/Operand">operand</a> I can just place the <a href="http://en.wikipedia.org/wiki/Operator">operator</a> before the equals sign and put the second operand after the equals sign to accomplish the same task without typing the variable name twice. If you understood that sentence you&#8217;re doing quite well!</p>
<p><span style="font-size:20px;font-weight:bold;">Jump into the sample code</span></p>
<p><strong>Psuedocode</strong></p>
<p>A good practice when developing code is to write psuedocode. Something that clearly states what you want to do in plain language. This is an outline of the structure that your program will take and it shouldn&#8217;t include any specific code, but will be replaced by that code later:</p>
<p><pre class="brush: cpp;">//Setup the clock
  //prepare an interrupt every 1 second

//Setup the I/O for the LED

//toggle the LED during each interrupt</pre></p>
<p>This program is so simple that the psuedocode seems unnecessary, but it will keep you focused and help stave off errors on larger projects.</p>
<p><strong>The Actual Code</strong></p>
<p>The main.c from the <a href="https://github.com/szczys/had_AVRtut_2/archives/master">Part 2 sample code</a> is embedded below. Take a minute to match up the parts of the psuedocode above with actual code blocks below.</p>
<p><pre class="brush: cpp; wrap-lines: false;">/*
* Hackaday.com AVR Tutorial firmware
* written by: Mike Szczys (@szczys)
* 10/24/2010
*
* ATmega168
* Blinks one LED conneced to PD0
*
* http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/
*/

#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;

int main(void)
{

  //Setup the clock
  cli();			//Disable global interrupts
  TCCR1B |= 1&lt;&lt;CS11 | 1&lt;&lt;CS10;	//Divide by 64
  OCR1A = 15624;		//Count 15624 cycles for 1 second interrupt
  TCCR1B |= 1&lt;&lt;WGM12;		//Put Timer/Counter1 in CTC mode
  TIMSK1 |= 1&lt;&lt;OCIE1A;		//enable timer compare interrupt
  sei();			//Enable global interrupts

  //Setup the I/O for the LED

  DDRD |= (1&lt;&lt;0);		//Set PortD Pin0 as an output
  PORTD |= (1&lt;&lt;0);		//Set PortD Pin0 high to turn on LED

  while(1) { }			//Loop forever, interrupts do the rest
}

ISR(TIMER1_COMPA_vect)		//Interrupt Service Routine
{
  PORTD ^= (1&lt;&lt;0);		//Use xor to toggle the LED
}</pre></p>
<p>The first few lines are comments for the benefit of human eyes and will not be used by the microcontroller. Comments in C are prefaced by two slashes (//) for single line comments or encased in slash-star (/*) and star-slash (*/) pairs for multiline comments. It&#8217;s a good idea to write comments that detail the program, what it does, what hardware it runs on, and any other helpful information. I find that I often reuse code from past projects and a bit of information at the top of the file helps locate what I&#8217;m looking for quickly.</p>
<p><strong>The Includes</strong></p>
<p>The next thing you see are the includes:</p>
<p><pre class="brush: cpp; wrap-lines: false;">#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;</pre></p>
<p>Includes tell the compiler that we&#8217;re going to be using things from other files. In this case, two files from <a href="http://www.nongnu.org/avr-libc/user-manual/">AVR Libc</a> that came with the cross-compiling toolchain we installed in <a href="http://hackaday.com/2010/10/23/avr-programming-introduction/">Part 1</a>. These are C files that allow us to use human-readable (and rememberable!) code when working with the hardware on the chip. The io.h file rolls header files for all of the supported AVR chips into one. We define what processor we&#8217;re using in our makefile, and the appropriate header file is automatically chosen from io.h when we compile our code later in this tutorial.</p>
<p>In our example code I&#8217;ve used names like DDRD, PORTD, TCCR1B, OCR1A, TIMSK1, etc. All of these have addresses that are pointed to using the io.h file. This allows us to call pins on the chip by the names like PORTD which are the same across all AVR variants instead of register addresses like 0x0B which has different functions on different chips. Most likely you&#8217;ll need to include io.h in every AVR program you use, and doing so makes your code more portable. The interrupt.h file is only needed if you are using interrupts, something we&#8217;ll talk about as we look at the next code block</p>
<p><strong>Setting up the clock for use with interrupts</strong></p>
<p>Processors need a clock signal in order to work. AVR chips can use external clocks like a crystal oscillator or a ceramic resonator, but they come from the factory configured to use the internal RC oscillator as the system clock (read more on page 28 of the datasheet). The internal RC oscillator of the ATmega168 runs at approximately 8.0 MHz depending on voltage stability and temperature. It also ships with the DIV8 fuse enabled which divides the clock signal down to 1.0 MHz. For the sample program I wanted an LED to blink between on and off, changing about once a second. Here&#8217;s the code block that sets that functionality up:</p>
<p><pre class="brush: cpp; wrap-lines: false;">  //Setup the clock
  cli();			//Disable global interrupts
  TCCR1B |= 1&lt;&lt;CS11 | 1&lt;&lt;CS10;	//Divide by 64
  OCR1A = 15624;		//Count 15624 cycles for 1 second interrupt
  TCCR1B |= 1&lt;&lt;WGM12;		//Put Timer/Counter1 in CTC mode
  TIMSK1 |= 1&lt;&lt;OCIE1A;		//enable timer compare interrupt
  sei();			//Enable global interrupts
</pre></p>
<p>The very first line has something to do with interrupts. An interrupt is a great feature of microprocessors. Basically you tell the chips to watch for a certain condition. When it matches that condition it will stop what it is doing no matter where it is, and run a different set of code called an Interrupt Service Routine (ISR). Because we are about to change some settings having to do with interrupts, we don&#8217;t want anything (like an interrupt) to stop us in the middle of this process. I&#8217;ve used a command that is available to us because we included interrupt.h at the beginning of our file. The command is <a href="http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html#ga68c330e94fe121eba993e5a5973c3162">cli();</a> which disables all interrupts. Once we are done with our settings we <span style="text-decoration:underline;">must</span> remember to enable them again, using the <a href="http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html#gaad5ebd34cb344c26ac87594f79b06b73">sei();</a> command. You can see I&#8217;ve done that at the bottom of this code block</p>
<p>Now we want to watch for the passage of 1 second worth of time. The four lines in between these two commands are used to setup a counter to do just that. Because the internal oscillator is running at 1 MHz, or 1 Million cycles per second, we must trigger an interrupt every 1 million cycles. The biggest timer this chip has is 16-bits which can only count from 0 to 65,535. In other words, we don&#8217;t have a timer that can count high enough to measure such a large number of cycles.</p>
<p>Fortunately, we have the option to use a divider with our timer, called a prescaler. To do so we look in the datasheet on page 134 to see a chart outlining the clock select. It shows prescaler options which divide the system clock by 1, 8, 64, 256, and 1024. Knowing that we want to count 1,000,000 cycles we can use a bit of math to choose the best prescaler:</p>
<pre style="padding-left:30px;">1,000,000 / 1 = 1,000,000
1,000,000 / 8 = 125,000
1,000,000 / 64 = 15,625
1,000,000 / 256 = 3,906.25
1,000,000 / 1024 = 976.5625</pre>
<p>The math only leaves us with one choice. That&#8217;s because using a prescaler of 1 or 8 results in a number of cycles that is larger than <a href="http://www.google.com/#hl=en&amp;expIds=17259,24416,26637,27060,27284,27357&amp;sugexp=ldymls&amp;xhr=t&amp;q=2%5E16&amp;cp=4&amp;pf=p&amp;sclient=psy&amp;aq=f&amp;aqi=h1g4&amp;aql=&amp;oq=2%5E16&amp;gs_rfai=&amp;pbx=1&amp;fp=2304850557947867">65,536</a> so our 16-bit timer can&#8217;t count high enough. Prescalers of 256 and 1024 give results that are not a whole number. If we don&#8217;t use a whole number we introduce an inaccuracy in our timing because we can&#8217;t measure a fraction of a cycle. A prescaler of 64 meets both our needs, being a whole number that is smaller than the limits of our 16-bit counter.</p>
<p>How can we set up this prescaler? The datasheet tells all. Looking at &#8220;Timer/Counter1 Control Register B&#8221; (TCCR1B) which spans pages 133 and 134 we can find the answer. Diagram 15-5 shows a clock settings table. In our case we need to set CS10 and CS11 to &#8217;1&#8242; on the TCCR1B register. To do this we use an OR operator and Left Shift a &#8217;1&#8242; to the location of the CS10 and CS11 bits:</p>
<p><pre class="brush: cpp; wrap-lines: false;">  TCCR1B |= 1&lt;&lt;CS11 | 1&lt;&lt;CS10;</pre></p>
<p>Because this is our first real bitwise math let&#8217;s look at it in depth. First off, we&#8217;re only setting two bits on the register so we do not want to use just an equals sign. If I had done that, this command would force all other bits to zero. Instead, I use shorthand code to use the OR operator to compare TCCR1B with a bitmask containing a &#8217;1&#8242; at the correct location for the CS10 and CS11 bits. Any other bits on the  TCCR1B register that are set to &#8217;1&#8242; will remain so.</p>
<p>I&#8217;ve created a bitmask to the right of the |= operator. As I talked about in the includes section, CS10 and CS11 are defined in io.h. But looking at the TCCR1B register we can see that CS10 is on bit 0 and CS11 is on bit 1. If you solved your math problem longhand it would look like this:</p>
<pre>1&lt;&lt;CS11 | 1&lt;&lt;CS10;
1&lt;&lt;1 | 1&lt;&lt;0;
0b00000010 | 0b00000001;
0b00000011;</pre>
<p>This is the method that you use for setting any bit for any purpose. It really is that simple. Build a bitmask and apply it to a register or variable. Just remember to be careful about preserving data that might already be stored on a register or in a value but using the OR operator during assignment.</p>
<p>Now that we have a divided clock source for the counter, and a target number of 15,625 cycles to watch for thanks to the math above. We can use one of the modes of Timer1, the Clear Timer on Compare Match (CTC), to trigger an interrupt at that exact cycle count. Take a look at page 121 of the datasheet and you will see we need to set OCR1A to our target value. We&#8217;ll set it to 15,624, one less than our cycle count because microcontroller timers start counting with the number zero, not one. This time we will use an equal sign because there are no other values stored in this register:</p>
<p><pre class="brush: cpp; wrap-lines: false;">  OCR1A = 15624;</pre></p>
<p>I also need to set the timer mode I want to use. Table 15-4 on page 133 has a lot of information on this. As discussed before, I want to use CTC mode so that narrows my choices on this table down to just two. I can choose between those because I know I&#8217;m using the value of OCR1A as the largest number the timer should count to, or TOP. The chart tells me to set the WGM12 bit on the TCCR1B register to 1.:</p>
<p><pre class="brush: cpp; wrap-lines: false;">  TCCR1B |= 1&lt;&lt;WGM12;</pre></p>
<p>This could have been done at the same time as the timer prescaler because they&#8217;re set on the same register. But it&#8217;s fine to do it in two steps because I&#8217;ve used the OR operator, making sure I&#8217;m not changing any of the other bits on this register.</p>
<p>The next step can be a &#8220;gotcha&#8221; for new developers. Everything is now setup correctly for our timer to trigger an interrupt at the appropriate interval. But if we don&#8217;t set the &#8220;interrupt enable&#8221; flag for that particular event, the interrupt will never happen. Page 136 of the datasheet cryptically discusses the use of the Timer/Counter Output Compare A Match Interrupt Enable. Setting this bit to 1 will enable the CTC interrupt we are planning to use:</p>
<p><pre class="brush: cpp; wrap-lines: false;">   TIMSK1 |= 1&lt;&lt;OCIE1A;</pre></p>
<p>Simple right? Do it a few times and it will be. There&#8217;s a lot of functionality with the timers on these chips and wading through the register settings is the price you pay for that power. But now we&#8217;re ready to go with 1-second interrupts.</p>
<p><strong>Initializing the Input/Output pins</strong></p>
<p>When an AVR chip resets, the pins are all placed in tri-state mode. At the beginning of the program any input and output pins need to be setup for their desired function. Starting on page 73 of the datasheet you can read about using pins as general input and output. There are three registers for each pin that we will generally be concerned with: Data Direction Register (DDR), Port register (PORT) and Pin register (PIN). Each of these will be suffixed with a letter corresponding to which set of pins we are working with. I&#8217;ve connected the LED to Port D so I need to work with DDRD, PORTD, and if I was using inputs, PIND.</p>
<p><pre class="brush: cpp; wrap-lines: false;">  //Setup the I/O for the LED

  DDRD |= (1&lt;&lt;0);		//Set PortD Pin0 as an output
  PORTD |= (1&lt;&lt;0);		//Set PortD Pin0 high to turn on LED</pre></p>
<p>The code above is used to set up an LED. Setting a bit on DDRD to 1 will make the corresponding pin an output. Setting it to zero would make it an input. Here I&#8217;ve set up an output because we are driving an LED. Outputs can be turned on or off by setting a 1 or a 0 to the PORT register respectively. So above I&#8217;ve used PORTD to turn on bit 0 which corresponds to pin connected to the LED.</p>
<p>If we were using a pin as an input the PORT register would be used to enable or disable an internal pull-up resistor and the PIN register would be used to measure the logic value currently present on that pin. Table 13-1 on page 74 shows the various states of I/O pins, but I&#8217;ll cover it more in part 4 of this series.</p>
<p><strong>The Loop</strong></p>
<p>Embedded programs must have an infinite loop that prevents the program from getting to the end and exiting. That&#8217;s because if our program exits the chip will just sit there and do nothing (after all, there&#8217;d be no program running). In this case I don&#8217;t need the loop to do anything since I&#8217;ve already set up the hardware and I&#8217;m using an interrupt to blink the LED:</p>
<p><pre class="brush: cpp; wrap-lines: false;">  while(1) { }			//Loop forever, interrupts do the rest</pre></p>
<p>I&#8217;ll add functionality to the loop in Part 4 or the series, but for now the &#8216;while(1)&#8217; loop just traps the program and does nothing else.</p>
<p><strong>Handling the interrupt</strong></p>
<p>Everything is now setup and ready to go, but nothing will happen unless we write code that does something after the interrupt happens. This is called an Interrupt Service Routine (ISR). The rest of the code is halted and this routine is run. It is best to keep this as short as possible, which is easy here because we just need to toggle the LED:</p>
<p><pre class="brush: cpp; wrap-lines: false;">ISR(TIMER1_COMPA_vect)		//Interrupt Service Routine
{
  PORTD ^= (1&lt;&lt;0);		//Use xor to toggle the LED
}</pre></p>
<p>If you look at page 62 of the datasheet you can see that the interrupt source for Timer/Counter1 Compare A match is called &#8220;TIMER1 COMPA&#8221;. We take this and use it as the input variable for the ISR, replacing spaces with underscores and adding a lower case &#8220;vect&#8221; at the end. This is how the compiler knows which ISR belongs to different interrupt sources. As for the LED itself, I&#8217;ve used the XOR operator and a bitmask. The bitmask ensures that only bit 0 will be changed.</p>
<h2>Compiling Code</h2>
<p>Before we leave this segment of the tutorial series you should give your compiler a test-drive.</p>
<p>The compiler takes our C code and turns it into a file that can be written to the microcontroller. The ins and outs of a compiler get a bit hairy and this isn&#8217;t the time to explain those details. But as you learn to write embedded code you should make an effort to also learn how this code will be interpreted by the compiler. Doing so will prevent a lot of headaches caused by optimization (the compiler trying to streamline your bloated C code) and it will allow you to make the most of your hardware both in terms of programming space, and functionality.</p>
<p>But for now there&#8217;s a make file included in <a href="https://github.com/szczys/had_AVRtut_2/archives/master">the example source from Part 2</a>. If you haven&#8217;t already, unzip that package and navigate to the &#8216;src&#8217; directory. There are two files in that directory, main.c and makefile. A makefile is a way to automate the compiling process. This one compiles, links, and programs a C code source file. If you look at the makefile you&#8217;ll notice that there are several user settings near the top. You need to setup the microprocessor for which you&#8217;ve written code, the name of the source file you&#8217;ve written (TARGET = main), the programmer you&#8217;re using (from the AVRdude list discussed in Part 2), and the port path for the programmer.</p>
<p>If you type &#8216;make&#8217; you should be able to compile the example program. Unless you have an AVR Dragon programmer and you&#8217;re running Linux you&#8217;ll get an error when it tries to program the chip, but it should compile the code and output several extra files:</p>
<p><pre class="brush: bash; wrap-lines: false;">$  ls -la
total 84
drwxr-xr-x 2 mike mike  4096 2010-11-04 14:20 .
drwxr-xr-x 3 mike mike  4096 2010-11-01 14:55 ..
-rw-r--r-- 1 mike mike   894 2010-10-24 12:34 main.c
-rw-r--r-- 1 mike mike    23 2010-11-04 14:20 main.d
-rw-r--r-- 1 mike mike    13 2010-11-04 14:20 main.eep
-rwxr-xr-x 1 mike mike  7121 2010-11-04 14:20 main.elf
-rw-r--r-- 1 mike mike   750 2010-11-04 14:20 main.hex
-rw-r--r-- 1 mike mike  5224 2010-11-04 14:20 main.lss
-rw-r--r-- 1 mike mike  5171 2010-11-04 14:20 main.lst
-rw-r--r-- 1 mike mike 14464 2010-11-04 14:20 main.map
-rw-r--r-- 1 mike mike  3972 2010-11-04 14:20 main.o
-rw-r--r-- 1 mike mike  1454 2010-11-04 14:20 main.sym
-rw-r--r-- 1 mike mike 10235 2010-10-24 10:44 makefile</pre></p>
<p>&#8216;main.hex&#8217; is the file that you can program onto the microcontroller. This makefile is extremely versatile. You can also see that it output &#8216;main.eep&#8217; which can be used to program the EEPROM on the chip if your code includes default data stored in the EEPROM. It can also be altered to output an assembler file, or binaries in different formats.</p>
<p>If you&#8217;re compiler didn&#8217;t spit out this information, there&#8217;s something wrong with your toolchain. Use your friend Google to search for any error messages and see if you can&#8217;t get things fixed up. Another great exercise would be to modify this file to work with your programmer. If you managed to get AVRdude working in Part 2 of this series, this alteration is as simple as changing the makefile to use those same settings.</p>
<h2>Conclusion</h2>
<p>That&#8217;s it for now. In the next installment of this series I&#8217;ll be talking about fuse bits, writing our own code, and I&#8217;ll try to touch on many of the different peripheral features of this chip. I&#8217;m plan to augment the original circuit with a few more LEDs (so make sure you have at least 8 of them and their matching resistors) along with adding a button for input. Thanks for reading!</p>
<h2><strong>Follow Me</strong></h2>
<p><a href="http://twitter.com/szczys">@szczys</a></p>
<h2>Resources</h2>
<p>Atmel AVR <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf">ATmega168 Datasheet</a> (PDF)</p>
<p><a href="http://www.nongnu.org/avr-libc/user-manual/">AVR Libc manual</a></p>
<br />Filed under: <a href='http://hackaday.com/category/how-to/'>how-to</a>, <a href='http://hackaday.com/category/microcontrollers/'>Microcontrollers</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/29460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/29460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/29460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/29460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/29460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/29460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/29460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/29460/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29460&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/avr-programming-for-everyone.jpg" medium="image">
			<media:title type="html">avr-programming-for-everyone</media:title>
		</media:content>
	</item>
		<item>
		<title>AVR Programming 02: The Hardware</title>
		<link>http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/</link>
		<comments>http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 13:00:18 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[ATmega168]]></category>
		<category><![CDATA[Atmel]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[avr-gcc]]></category>
		<category><![CDATA[avrdude]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[dapa]]></category>
		<category><![CDATA[dragon]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[stk500]]></category>
		<category><![CDATA[usbtinyisp]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=29425</guid>
		<description><![CDATA[You may be able to write the most eloquent code in the history of embedded systems but without a way to run it on the hardware it will be worthless. In this installment of the tutorial series we will: Look at some of the available AVR programmer options Place the microcontroller on a breadboard and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29425&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-29579" title="avr-programming-for-everyone" src="http://hackadaycom.files.wordpress.com/2010/10/avr-programming-for-everyone.jpg" alt="" width="470" height="150" /></p>
<p>You may be able to write the most eloquent code in the history of embedded systems but without a way to run it on the hardware it will be worthless. In this installment of the tutorial series we will:</p>
<ul>
<li>Look at some of the available AVR programmer options</li>
<li>Place the microcontroller on a breadboard and connect it to a power supply and a programmer.</li>
<li>Use programming software to send some example code to the microcontroller</li>
</ul>
<p>If you missed <a href="http://hackaday.com/2010/10/23/avr-programming-introduction/">Part 1</a> take a few minutes to review that portion of the tutorial and then join us after the break.</p>
<p><strong>Series roadmap:</strong></p>
<ul>
<li><a title="Permanent Link to AVR Programming 01: Introduction" rel="bookmark" href="http://hackaday.com/2010/10/23/avr-programming-introduction/">AVR Programming 01: Introduction</a></li>
<li><a title="Permanent Link to AVR Programming 01: Introduction" rel="bookmark" href="http://hackaday.com/2010/10/23/avr-programming-introduction/"></a><a title="Permanent Link to AVR Programming 02: The Hardware" rel="bookmark" href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/">AVR Programming 02: The Hardware</a></li>
<li><a title="Permanent Link to AVR Programming 02: The Hardware" rel="bookmark" href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/"></a><a title="Permanent Link to AVR Programming 03: Reading and compiling code" rel="bookmark" href="http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/">AVR Programming 03: Reading and compiling code</a></li>
<li><a href="http://hackaday.com/2010/11/19/avr-programming-04-writing-code-etc/">AVR Programming 04: Writing code</a></li>
</ul>
<p><span id="more-29425"></span></p>
<h2>Programmers</h2>
<p>As I said before, if you want to get it on the chip you&#8217;ve got to have a programmer. There are a huge number of options, but I&#8217;ll cover a few of the easiest and least expensive. We are focusing on <a href="http://en.wikipedia.org/wiki/In-system_programming">In-System Programming</a> (ISP) which means that you can program the chip without removing it from the circuit.</p>
<p><strong>DAPA Cable</strong></p>
<p><strong><img class="alignnone size-full wp-image-29463" title="dapa-cable" src="http://hackadaycom.files.wordpress.com/2010/10/dapa-cable.jpg" alt="" width="470" height="249" /></strong></p>
<p>A Direct AVR Parallel Access, or DAPA cable, is an incredibly simple and cheap programming method. You can build one very quickly for a few bucks worth of parts, but the convenience comes with a few gotchas. The first is that you must have a parallel port on your computer; something that modern laptop and some modern desktops don&#8217;t have. But if you&#8217;ve got an old PC around that has one this will get you up and programming in no time.</p>
<p>In fact, the first AVR prototyping I did was with one of these cables. That is, until I discovered another gotcha. This will only program low-speed chips. If you try to run the chip&#8217;s clock at full speed (by changing fuse settings&#8230; more in Part 3) you won&#8217;t be able to use a DAPA cable to talk to it any longer. There&#8217;s also the possibility of damaging your parallel port or worse if you do something wrong. But if you want to go for it anyway, here&#8217;s how I built mine.</p>
<p><a href="http://hackadaycom.files.wordpress.com/2010/10/dapa-cable-construction.jpg"><img class="alignnone size-large wp-image-29581" title="dapa-cable-construction" src="http://hackadaycom.files.wordpress.com/2010/10/dapa-cable-construction.jpg?w=450&#038;h=159" alt="" width="450" height="159" /></a></p>
<p>It connects to a computer using a DB25 connector. As you can see in the schematic, I&#8217;ve used 1 kilo Ohm resistors on the Reset, SCK, MISO, and MOSI pins for current protection. I did not use a resistor on the ground pin. I used a piece of ribbon cable, soldering one end to each of the five signal lines shown in the schematic. On the other end of the ribbon cable I used a connector housing with six slots, filling one of them with a blank so that I could keep track of the signals. This is easy to plug into a pin header or connect to jumper wires as shown above. In retrospect it may have been a better choice to use a 2&#215;3 IDC connector and route the signals using the <a href="http://hackadaycom.files.wordpress.com/2010/10/avr-isp-header.jpg">AVR ISP standard</a> (from <a href="http://www.atmel.com/atmel/acrobat/doc0943.pdf">AVR: In-System Programming PDF</a>). If you go this route chances are you&#8217;ll upgrade before long so don&#8217;t agonize of the design details.</p>
<p><strong>Arduino</strong></p>
<p><strong><img class="alignnone size-full wp-image-29456" title="arduino" src="http://hackadaycom.files.wordpress.com/2010/10/arduino-e1287444768740.jpg" alt="" width="470" height="349" /><br />
</strong></p>
<p>I would be remiss to skip over using an Arduino as a programmer. They&#8217;re ubiquitous with the embedded systems crowd and if you don&#8217;t already own one, you can try to find someone to lend you theirs for a little while. All that is required is to write an AVR programmer sketch to the Arduino and make the programming connections. We&#8217;ll take a look at this method later in the post.</p>
<p><strong>USBtinyISP</strong></p>
<p><strong><img class="alignnone size-full wp-image-29457" title="USBtinyISP" src="http://hackadaycom.files.wordpress.com/2010/10/usbtinyisp-e1287444879969.jpg" alt="" width="470" height="353" /><br />
</strong></p>
<p>The <a href="http://www.ladyada.net/make/usbtinyisp/index.html">USBtinyISP</a> is an In-System-Programmer based around an ATtiny2313 that uses a USB connection (see where the name comes from?). It isn&#8217;t a bad choice for your first programmer. If you are confident in your skills you can build the circuit circuit yourself and use a DAPA cable to get the programming firmware onto the chip. Or you can just buy it from Adafruit Industries. But if you think you&#8217;re going to be serious about AVR development, you should consider shelling out the extra bucks for a professional programmer.</p>
<p><strong>Professional programmers</strong></p>
<p><strong><img class="alignnone size-full wp-image-29546" title="atmel-programmers" src="http://hackadaycom.files.wordpress.com/2010/10/atmel-programmers.jpg" alt="" width="470" height="165" /><br />
</strong></p>
<p>The Ateml programmers are the gold standard. They offer something that none of the other hardware we&#8217;ve covered has, the ability to recover a chip that you&#8217;ve messed up. If you want to use the reset pin as I/O, you will need to use High Voltage Parallel Programming to talk to your chip. Even if you don&#8217;t <em>decide</em> to do that, at some point you&#8217;re going to screw up and you&#8217;ll need to recover a process, which helps offset the extra cost of a professional programmer. It is possible to use an Arduino for High Voltage Parallel Programming to recover your AVR, <a href="http://hackaday.com/2009/03/13/avr-hv-rescue-shield/">but that&#8217;s another hack</a> in itself.</p>
<p>We use an <a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3891">AVR Dragon</a> for pretty much everything. But <a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2735">the STK500</a> is a very popular board even though you need a serial port to use it. It has chip sockets, buttons, and LEDs for on-board prototyping. The Dragon leaves options open with unpopulated socket footprints, and it uses a USB connection.</p>
<p>If you&#8217;re in this for the long haul there&#8217;s no substitute for one of these choices.</p>
<p>We should at least mention <a href="http://www.atmel.com/dyn/Products/tools_card.asp?tool_id=3353">the MKII</a>, a programmer that offers ISP in the same way that the USBtinyISP does, but also provides JTAG, debug wire, and few others. We have no experience with this unit so you&#8217;ll have to do your own research if you&#8217;d like to know more. As for the other programmers out there, use Google or check the comments to this post as people usually don&#8217;t like to keep their preferred programmer choice a secret.</p>
<p><strong>Bootloader</strong></p>
<p>A bootloader is not really a programmer, but a way to get around using one. A bootloader is a set of code already on your microprocessor. It handles basic input and output neccessary to write your code into the chip&#8217;s memory. The bad news is that they do take up programming space, but you won&#8217;t have to buy a hardware programmer.</p>
<p>Programming a chip with a bootloader on it is beyond the scope of this tutorial. But it&#8217;s not hard to learn to do. In fact, this is how it is possible to program an Arduino without a separate hardware programmer.</p>
<h2>Setting up our test circuit</h2>
<p>Enough talk, let&#8217;s build something! We need four things: A microcontroller, something to power it, some way to program it, and something to show us it&#8217;s working.</p>
<p><strong>Hardware:</strong></p>
<ul>
<li>Solderless breadboard</li>
<li>Jumper wires</li>
<li>ATmega168 microcontroller</li>
<li>78L05 voltage regulator</li>
<li>100uf electrolytic capacitor</li>
<li>10uf electrolytic capacitor</li>
<li>LED</li>
<li>180 Ohm resistor (any resistor between 180 and 330 Ohms will work fine)</li>
<li>A programmer (we&#8217;ll show both a DAPA and an Arduino)</li>
</ul>
<p><strong>What we&#8217;re doing</strong></p>
<p>In a  nutshell, we&#8217;re going to blink an LED as our first embedded program.  This takes a few components: a power supply, the microcontroller itself, and the LED and its current limiting resistor.</p>
<p>The power supply consists of a voltage regulator which will take an input voltage above 7v and output a constant voltage of 5V. In order to work correctly, this circuit requires two filtering capacitors. The capacitors act like storage tanks, absorbing small fluctuations on the power rail to provide a steady source of electricity to keep our microcontroller safe and happy.</p>
<p>As an output we are going to use an LED. We must include a resistor to limit the amount of current that will flow when the software lights it up. Without this current limiting resistor, current would flow at levels that are unsafe for the LED, the microcontroller, or both.</p>
<p><strong>The circuit schematic</strong></p>
<p><a href="http://hackadaycom.files.wordpress.com/2010/10/m168-blink.png"><img class="alignnone size-large wp-image-29545" title="m168-blink" src="http://hackadaycom.files.wordpress.com/2010/10/m168-blink.png?w=450&#038;h=210" alt="" width="450" height="210" /></a></p>
<p>Above is the circuit we are using as an example. The a simple 5v regulator circuit using an LM7805 linear regulator and two filtering capacitors is on the left, separated from the rest by a dotted box. If you already have some type of regulated 5v supply save yourself some time and use that.</p>
<p>You may also notice that the chip in the schematic is labelled AVR-MEGA8. The ATmega168 that we&#8217;re using is pin-compatible with at ATmega8. That means that you can swap one for the other and all 28 pins will be where they&#8217;re supposed to be, so this will cause no issue.</p>
<p>It is a good practice to add a few components not seen here. There should be two 0.1 uF capacitors for <a href="http://en.wikipedia.org/wiki/Decoupling#Electronics">decoupling</a>; they filter out fluctuations on the power rails called noise. One between VCC and GND, the other between AVCC and AGND (as close as possible to the pins). There should also be a pull-up resistor on the reset pin with lets an incredibly small amount of current trickle into the pin at a 5V level. This the chip from resetting by accident when it&#8217;s floating (not connected so there&#8217;s no clear 0 or 5V value). I&#8217;ve omitted these parts for simplicity and it shouldn&#8217;t be an issue with this simple project. But as your projects get more complicated, neglecting these considerations will come back to bite you.</p>
<p><strong>The circuit built on a breadboard</strong></p>
<p><strong><img class="alignnone size-full wp-image-29547" title="wiring1-avrTut-pt2" src="http://hackadaycom.files.wordpress.com/2010/10/wiring1-avrtut-pt2.jpg" alt="" width="470" height="284" /></strong></p>
<p>I started building the circuit by adding the voltage regulator to the breadboard. Then connect the ground leg to the ground rail on top of your breadboard, and the output leg to the voltage rail of your breadboard. I have also added two wires that I will eventually connect to the positive and negative terminals of a 9V battery.</p>
<p>It is important to read the datasheet for your voltage regulator (example: <a href="http://www.fairchildsemi.com/ds/LM/LM7805.pdf">LM7805</a>) to figure out which lead is input, ground, and output. Your regulator may look different from mine as they do come in different packages. In the image above, the input lead is on the left, the ground is in the middle, and the output lead is to the right.</p>
<p><img class="alignnone size-full wp-image-29548" title="wiring2-avrTut-pt2" src="http://hackadaycom.files.wordpress.com/2010/10/wiring2-avrtut-pt2.jpg" alt="" width="470" height="372" /></p>
<p>Now I&#8217;ve completed the power supply by adding the 100 uF capacitor between the input leg and ground leg of the regulator, and the 10 uF capacitor between the output leg and ground leg. Pay careful attention to these capacitors, one lead should be marked as negative (a band with a minus sign) on the case of each capacitor. Before adding the microcontroller it would be a good idea to check the voltage output using a multimeter. Too much juice can destroy your new chip.</p>
<p>After checking to make sure I had a steady 5V source, then disconnecting the battery, I added the ATmega168 microcontroller to the board. Note that the dimple is pointing to the left. This is important, as <a href="http://en.wikipedia.org/wiki/Dual_in-line_package#Orientation_and_lead_numbering">the standard orientation and lead numbering of a DIP package</a> shows that pin 1 is now on the lower left, letting us easily find the other pins that we need.</p>
<p>Power and ground have been connected to the chip as well. Pin 7 (VCC) and Pin 20 (AVCC) have been connected to 5V. Pin 8 (GND) and Pin 22 (AGND) have both been connected to ground.</p>
<p><img class="alignnone size-full wp-image-29549" title="wiring3-avrTut-pt2" src="http://hackadaycom.files.wordpress.com/2010/10/wiring3-avrtut-pt2.jpg" alt="" width="470" height="305" /></p>
<p>The final step is to connect the LED to output 0 on Port D. Our schematic tell us that we want to connect the positive lead of the LED to Pin 2 on the ATmega168, and the negative lead should go to an unoccupied row on the breadboard (make sure you don&#8217;t attach it to Pin 1). LEDs usually have a small notch flattened on one side of the plastic case to denote the negative leg of the device. The final piece of the puzzle is to connect the negative side of the LED to ground by using our resistor.</p>
<p>In the image above I&#8217;ve hooked up a 9V battery , but nothing happened. That&#8217;s because there&#8217;s no firmware on the chip to make the LED blink yet. We&#8217;ll need to fix that in the next step.</p>
<h2><strong>Programming our test circuit</strong></h2>
<p>Check all of your connections one more time and let&#8217;s get ready to program the microcontroller.</p>
<p><strong>Connecting to a programmer</strong></p>
<p>You only need to make six connections in order to program our chip:</p>
<ul>
<li>Voltage</li>
<li>Ground</li>
<li>Master In Slave Out (MISO)</li>
<li>Master Out Slave In (MOSI)</li>
<li>Reset (RST)</li>
<li>Slave Clock (SCK)</li>
</ul>
<p>This is true for any programmer that is using In-System Programming. There&#8217;s even <a href="http://hackadaycom.files.wordpress.com/2010/10/avr-isp-header.jpg">a standardized 6-pin header</a> that I design into most of my circuits so that you can easily reconnect your programmer to a circuit board and update the firmware down the line. But for this example we&#8217;ll just use some jumper wires to make the connections. One thing to keep in the back of your mind is to only use one voltage source when programming. You should either disconnect the power to your circuit while programming, or do not make a connection to the voltage line on your programmer.</p>
<p><strong>Connecting an Arduino as a programmer</strong></p>
<p>Using your Arduino as a programmer is super easy. The first thing you&#8217;ll want to do is open up the Arduino IDE, and then open the example software: ArduinoISP.pde (in the examples/ArduinoISP folder). Flash it to your Arduino in the normal fashion. Now follow the directions for <a href="http://arduino.cc/en/Tutorial/ArduinoISP">targeting an AVR on a breadboard</a> (bottom of that page). <strong>Important:</strong> Choose one power source. That is to say, either connect the voltage on the Arduino board to your breadboard, OR connect the battery to the power supply we wired up. Doing both has the potential to damage your hardware.</p>
<p>Here&#8217;s how mine looked once I had it hooked up.</p>
<p><img class="alignnone size-full wp-image-29551" title="arduino-ISP-programmer" src="http://hackadaycom.files.wordpress.com/2010/10/arduino-isp-programmer.jpg" alt="" width="470" height="351" /></p>
<p>Now that everything is ready to go, jump to the next section: Flashing firmware with AVRdude.</p>
<p><strong>Connecting using a DAPA cable</strong></p>
<p><strong> </strong>Depending on how you constructed your DAPA cable, it should be pretty easy to make the five connections we need. Notice that the DAPA cable doesn&#8217;t have a Voltage connection. The target processor must have its own power source (like the power supply we built on the breadboard) during programming. Here is what my DAPA cable looks like once connected.</p>
<p><img class="alignnone size-full wp-image-29552" title="DAPA-ISP-programmer" src="http://hackadaycom.files.wordpress.com/2010/10/dapa-isp-programmer.jpg" alt="" width="470" height="386" /></p>
<p>If you&#8217;re unsure of the connection that need to be made, go back and compare the DAPA cable design to the circuit schematic. Match up our five connections: MISO, MOSI, RST, SCK, and GND.</p>
<h2>Flashing firmware with AVRdude</h2>
<p>If you did your homework from Part 1 of this series you should already have the cross compiler tools installed. First, <a href="https://github.com/szczys/had_AVRtut_2/archives/master">download the firmware package</a> and navigate to that directory in a shell, or at the command prompt. The following commands can be used on Linux and OSX systems to program the chip.</p>
<p style="padding-left:30px;">Arduino as the programmer:</p>
<pre style="padding-left:30px;">avrdude -P usb -b 19200 -c avrisp -p m168 -U flash:w:main.hex</pre>
<p style="padding-left:30px;">DAPA as the programmer:</p>
<pre style="padding-left:30px;">avrdude -P /dev/parport0 -c dapa -p m168 -U flash:w:main.hex</pre>
<p style="padding-left:30px;">AVR Dragon as the programmer:</p>
<pre style="padding-left:30px;">avrdude -P usb -c dragon_isp -p m168 -U flash:w:main.hex</pre>
<p style="padding-left:30px;">USBtinyISP as the programmer:</p>
<pre style="padding-left:30px;">avrdude -P usb -c usbtiny -p m168 -U flash:w:main.hex</pre>
<p>You can get help from the AVRdude program by running:</p>
<pre style="padding-left:30px;">avrdude -h</pre>
<p>That will print out a list of available commands, or you can read <a href="http://www.nongnu.org/avrdude/user-manual/avrdude.html">the online documentation</a>. <strong>Windows users will need to change the /dev/* portion of the command</strong> to match your connection. You should find the <a href="http://www.nongnu.org/avrdude/user-manual/avrdude_19.html">Windows page of the online manual</a> particularly helpful for this. Standard Windows port names include com0, com1, etc. for serial ports and lpt0, lpt1, etc. for parallel ports.</p>
<p>As for the other flags used in the programming commands above:</p>
<p>When using the Arduino as an ISP programmer you must specify the speed, using &#8216;-b&#8217;. That value is set in the Arduino sketch and should be 19200 by default.</p>
<p>You will always need to specify what kind of chip is connected to the programmer. Here I&#8217;ve used &#8216;-p m168&#8242; for our ATmega168. Get a list of all compatible microprocessors by typing</p>
<pre style="padding-left:30px;">avrdude -p ?</pre>
<p>The same is true for specifying a programmer. You can change the &#8216;-p&#8217; to &#8216;-c&#8217; in the command above to get a list of programmers.</p>
<p>The final option in the commands we used tells the programmer to write (that&#8217;s the &#8216;w&#8217;) the file &#8216;main.hex&#8217; to flash memory. Part of the command is used for many things, including changing the fuse bits on the chip. I&#8217;ll talk about this in Part 3 of the series.</p>
<h2>Debugging</h2>
<p>Your LED should be flashing away quite happily at this point. What&#8217;s that? It&#8217;s not? Time to start the real learning. Here&#8217;s a list to get you started:</p>
<ul>
<li>Did you successfully program the chip? You should get the message: &#8220;258 bytes of flash verified&#8221; and &#8220;avrdude done. Thank you.&#8221;</li>
<li>If you had an error during programming, check first to make sure there is power going to your chip.</li>
<li>Try the programming command again using &#8216;-v&#8217; in place of &#8216;flash:w:main.hex&#8217;. This will just attempt to talk to the chip instead of writing to it, and is very handy when working out programming bugs</li>
<li>Recheck your programming connections to ensure you&#8217;ve got the correct signals connected to the right pins</li>
<li>Make sure you have the correct port on the computer and that you have permission to use that port. Linux users may try talking to the chip with the -v flag as ROOT to discover if there is a permission problem. If this works you need to add your user to the group that has permission to access the port the programmer is connected to</li>
<li>If you did successfully program the chip you should recheck your hardware. Is the LED installed backwards, preventing it from lighting up?</li>
<li>Take a trip to Google and start searching&#8230; this usually plays a roll in the development process so don&#8217;t feel bad. A lot of folks have already experienced the trouble you&#8217;re having and they made it through okay in the end.</li>
</ul>
<h2>Conclusion</h2>
<p>You&#8217;ve done it, your first embedded circuit is alive! For now it will just flash to let you know everything is working. But next time we&#8217;ll talk about how this was accomplished, what we can do to make it behave differently, and how to use the compiler to translate our code changes into a file that the microcontroller can run. Thanks for reading and we&#8217;ll see you back here for the next installment.</p>
<p><span style="font-size:x-large;"><span style="font-size:20px;font-weight:800;">Follow Me</span></span></p>
<p><a href="http://twitter.com/szczys">@szczys</a></p>
<h2><strong>Resources</strong></h2>
<p>Firmware package: <a href="https://github.com/szczys/had_AVRtut_2/archives/master">Package download</a> or <a href="https://github.com/szczys/had_AVRtut_2">Github page</a></p>
<p>Atmel AVR <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf">ATmega168 Datasheet</a> (PDF)</p>
<p><a href="http://www.nongnu.org/avrdude/user-manual/avrdude.html">AVR dude online documentation</a></p>
<p><a href="http://www.atmel.com/atmel/acrobat/doc0943.pdf">AVR In-System Programming Application Note</a> (PDF)</p>
<p>AVR ISP Programming Header:</p>
<p><img class="alignnone size-full wp-image-29582" title="avr-isp-header" src="http://hackadaycom.files.wordpress.com/2010/10/avr-isp-header.jpg" alt="" width="470" height="181" /></p>
<br />Filed under: <a href='http://hackaday.com/category/how-to/'>how-to</a>, <a href='http://hackaday.com/category/microcontrollers/'>Microcontrollers</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/29425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/29425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/29425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/29425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/29425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/29425/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/29425/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/29425/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29425&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/avr-programming-for-everyone.jpg" medium="image">
			<media:title type="html">avr-programming-for-everyone</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/dapa-cable.jpg" medium="image">
			<media:title type="html">dapa-cable</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/dapa-cable-construction.jpg?w=450" medium="image">
			<media:title type="html">dapa-cable-construction</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/arduino-e1287444768740.jpg" medium="image">
			<media:title type="html">arduino</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/usbtinyisp-e1287444879969.jpg" medium="image">
			<media:title type="html">USBtinyISP</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/atmel-programmers.jpg" medium="image">
			<media:title type="html">atmel-programmers</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/m168-blink.png?w=450" medium="image">
			<media:title type="html">m168-blink</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/wiring1-avrtut-pt2.jpg" medium="image">
			<media:title type="html">wiring1-avrTut-pt2</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/wiring2-avrtut-pt2.jpg" medium="image">
			<media:title type="html">wiring2-avrTut-pt2</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/wiring3-avrtut-pt2.jpg" medium="image">
			<media:title type="html">wiring3-avrTut-pt2</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/arduino-isp-programmer.jpg" medium="image">
			<media:title type="html">arduino-ISP-programmer</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/dapa-isp-programmer.jpg" medium="image">
			<media:title type="html">DAPA-ISP-programmer</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/avr-isp-header.jpg" medium="image">
			<media:title type="html">avr-isp-header</media:title>
		</media:content>
	</item>
		<item>
		<title>AVR Programming 01: Introduction</title>
		<link>http://hackaday.com/2010/10/23/avr-programming-introduction/</link>
		<comments>http://hackaday.com/2010/10/23/avr-programming-introduction/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 16:00:20 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[how-to]]></category>
		<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=29423</guid>
		<description><![CDATA[We love looking at hardcore electronics projects with a beefy microcontroller and hundreds, if not thousands, of lines of code at its center. But everyone needs to get there somehow. This tutorial series aims to make you comfortable programming the Atmel AVR line of microcontrollers. Whether you&#8217;ve never touched a microcontroller before, or you&#8217;ve cut [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29423&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-29579" title="avr-programming-for-everyone" src="http://hackadaycom.files.wordpress.com/2010/10/avr-programming-for-everyone.jpg" alt="" width="470" height="150" /></p>
<p>We love looking at hardcore electronics projects with a beefy microcontroller and hundreds, if not thousands, of lines of code at its center. But everyone needs to get there somehow.</p>
<p>This tutorial series aims to make you comfortable programming the <a href="http://www.atmel.com/products/AVR/">Atmel</a><a href="http://www.atmel.com/products/AVR/"> AVR line of microcontrollers</a>. Whether you&#8217;ve never touched a microcontroller before, or you&#8217;ve cut your teeth with dozens of Arduino projects, this will help you get right down to the hardware and give you the confidence to build anything.</p>
<p><strong>Series roadmap:</strong></p>
<ul>
<li><a title="Permanent Link to AVR Programming 01: Introduction" rel="bookmark" href="http://hackaday.com/2010/10/23/avr-programming-introduction/">AVR Programming 01: Introduction</a></li>
<li><a title="Permanent Link to AVR Programming 01: Introduction" rel="bookmark" href="http://hackaday.com/2010/10/23/avr-programming-introduction/"></a><a title="Permanent Link to AVR Programming 02: The Hardware" rel="bookmark" href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/">AVR Programming 02: The Hardware</a></li>
<li><a title="Permanent Link to AVR Programming 02: The Hardware" rel="bookmark" href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/"></a><a title="Permanent Link to AVR Programming 03: Reading and compiling code" rel="bookmark" href="http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/">AVR Programming 03: Reading and compiling code</a></li>
<li><a href="http://hackaday.com/2010/11/19/avr-programming-04-writing-code-etc/">AVR Programming 04: Writing code</a></li>
</ul>
<p><span id="more-29423"></span></p>
<p><strong>Prerequisite knowledge</strong></p>
<p>Here&#8217;s the good news: I&#8217;ve set the bar quite low. You need basic knowledge of installing programs on your computer and using them. You should have some idea of <a href="http://en.wikipedia.org/wiki/Breadboard#Bus_and_terminal_strips">how a solderless breadboard works</a> and it is advisable that you have a multimeter and know how to measure voltage with it. And you shouldn&#8217;t be afraid of using Google to research questions that aren&#8217;t explicitly answered here.</p>
<p><strong>What does a microcontroller actually do?</strong></p>
<p>This is a loaded question. For the sake of understanding I&#8217;ll take this down to the most simple explanation:</p>
<ol>
<li>A microcontroller takes some type of input</li>
<li>It makes a decision based on the software you have written</li>
<li>The outputs are changed based on the decision in step 2.</li>
</ol>
<p>A microcontroller does what you program it to do. It does so quickly, and reliably.</p>
<p><strong>How does it work?</strong></p>
<p>For this tutorial series I will be discussing digital logic. That is to say that all input and output pins will be judged based on a voltage of zero, or 5V. This produces our digital 1&#8242;s and 0&#8242;s, with 5 volts as a one, and zero volts as a zero.</p>
<p>So if you want to light up an LED just wire up the circuit to a pin, make that pin an output, and set it to a logic high (5 volts). If you want to add a button, connect it to a pin that is set as an input and program the chip to measure the voltage level of that pin. It really is that easy, once you learn how to write the correct commands so that the chip understands your wishes.</p>
<p><strong>A look at he chip itself</strong></p>
<p>I&#8217;ve decided to use an ATmega168 microcontroller. It&#8217;s a powerful chip but it&#8217;s no harder to start using than its younger brethren. It will leave plenty of room for you to grow into your projects, while remaining affordable (less than $4.50). Here&#8217;s a diagram of it:</p>
<p><img class="alignnone size-full wp-image-29605" title="atmega168-pinout" src="http://hackadaycom.files.wordpress.com/2010/10/atmega168-pinout.jpg" alt="" width="470" height="291" /></p>
<p>This is often called the pinout as it shows what each of the 28 pins on the chip actually does. All of these pins have multiple functions and that&#8217;s why there&#8217;s long lines of text next to each, except for five which only have one name. These are the pins having do with voltage and ground (VCC, GND, AVCC, AREF, AGND), an important issue with microcontrollers.</p>
<p>Integrated circuits need a steady voltage source. This means as part of our project we&#8217;ll need to build a voltage regulator. This is an easy thing to do on a breadboard, and you should be able to get your hands on the parts locally. It is also worth noting that there is a semi-circular dimple on the top of the chip. This is something you&#8217;ll find in the plastic case of these dual-inline-package chips an it&#8217;s used to make sure you don&#8217;t plug it in backwards.</p>
<p>Take a look at the pinout once again and look for the pins whose names start with PD. You should see eight of them total, labeled PD0 through PD 7. This is a fantastic example of the 8-bit nature of these chips. PD stands for Port D, one of the input and output register. <strong><em>Everything in these chips centers around 8-bits. </em></strong>That&#8217;s a sequence of eight 1&#8242;s or zeros in different combination. If you want to turn on or off specific features, you change one or more bits in a 8-bit register. Every time you want to change one pin you must address all eight in the register. We&#8217;ll learn much more about this but not until the third part of the series.</p>
<p><strong>Programming</strong></p>
<p>The ATmega168 is a programmable microcontroller. But better yet, it&#8217;s reprogrammable. In fact, when you&#8217;re working on a project you&#8217;ll most likely reprogram it several times an hour.</p>
<p>This chip has a size limit of 16 kilobytes of programming space. In these modern times of 64 gigabyte iPods 16 kilobytes might sound minuscule. But in reality that&#8217;s 16 kilobytes of machine code. You can do a lot with that&#8230; trust me.</p>
<p>You do need some type of hardware to get the code onto these chips. Usually this comes in the form of an AVR programmer. In the second part of this tutorial we&#8217;ll look at several different programming options, then build and program a test circuit.</p>
<h2>Do Your Homework</h2>
<p>To get ready for the rest of this tutorial series I need you to gather some tools. You must have some type of computer, be it a Linux box, Mac, or Windows PC. This will run software that takes our code, compiles it into something the microcontroller can use, and then tells a programmer how to write it to our chip.</p>
<p><strong>The compiler</strong></p>
<p>We&#8217;re eventually going to be writing our own code for the AVR, which uses the RISC architecture. But we&#8217;re doing this on a computer with x86 architecture. The tool necessary to accomplish this is called a <a href="http://en.wikipedia.org/wiki/Cross_compiler">cross-compiler</a>. This is quite possibly the best reason to choose AVR for development, there&#8217;s an excellent tool chain available that can easily be installed on multiple platforms.</p>
<ul>
<li>Mac users: Install <a href="http://www.obdev.at/products/crosspack/download-de.html">CrossPack</a></li>
<li>Windows users: Install <a href="http://sourceforge.net/projects/winavr/">WinAVR</a></li>
<li>Linux users: Debian and Ubuntu users should install the GCC-AVR package which includes the entire toolchain. Others may want to look at the <a href="http://www.nongnu.org/avr-libc/user-manual/overview.html">AVR-libc toolchain page</a> for help compiling the packages.</li>
</ul>
<p>This is not the only option. Many Windows users swear by <a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725">Atmel&#8217;s free AVR Studio software</a>. This is the only time I&#8217;ll reference it as I don&#8217;t have a Windows machine and have never tried that package.</p>
<p><strong>Programming software</strong></p>
<p>Our software-of-choice to run the hardware programmer is called AVRdude. If you installed one of the toolchains above you should already have this program. Go to a terminal window or the command prompt and type the following to make sure:</p>
<pre>avrdude -h</pre>
<p>This will show the help screen. If you get an error, you should check to make sure you properly installed the toolchain in the previous step, <a href="http://savannah.nongnu.org/projects/avrdude/">or go download AVRdude yourself</a>.</p>
<h2>What the future holds</h2>
<p>That wraps up the introductory installment of this series.</p>
<p><strong><a href="http://hackaday.com/2010/10/25/avr-programming-02-the-hardware/">Part 2</a>: </strong>In the next installment of this series we&#8217;ll take a look at several pieces of hardware that you can use to program an AVR microcontroller. I&#8217;ve written a <a href="http://en.wikipedia.org/wiki/Hello_world_program">hello world</a> program and will walk you through building the circuit on a breadboard, connecting the chip to a programmer, and using AVRdude to write this simple firmware to the device. I don&#8217;t want to get you too excited, but this does involve a flashing LED.</p>
<p><strong><a href="http://hackaday.com/2010/11/05/avr-programming-03-reading-and-compiling-code/">Part 3</a>:</strong> A pre-compiled HEX file was used to program the AVR microcontroller in Part 2 of the series. In this portion we&#8217;ll look at the C language source code that made up that firmware. I&#8217;ll also talk in-depth about the peripherals available on the chip and detail how to use them. We&#8217;ll finish up by adding functionality to the original program, recompile it, and reprogram the chip with the upgraded version.</p>
<p><strong>Part 4: </strong>Now that you&#8217;ve acquired AVR programming skills I&#8217;ll show you how to start building cool stuff with them.</p>
<h2>Follow me:</h2>
<p><a href="http://twitter.com/szczys">@szczys</a></p>
<br />Filed under: <a href='http://hackaday.com/category/how-to/'>how-to</a>, <a href='http://hackaday.com/category/microcontrollers/'>Microcontrollers</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/29423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/29423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/29423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/29423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/29423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/29423/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/29423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/29423/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29423&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/10/23/avr-programming-introduction/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/avr-programming-for-everyone.jpg" medium="image">
			<media:title type="html">avr-programming-for-everyone</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/atmega168-pinout.jpg" medium="image">
			<media:title type="html">atmega168-pinout</media:title>
		</media:content>
	</item>
		<item>
		<title>C Sharp Development 101 &#8211; Part 1: Hello World</title>
		<link>http://hackaday.com/2010/09/30/c-sharp-development-101-part-1-hello-world/</link>
		<comments>http://hackaday.com/2010/09/30/c-sharp-development-101-part-1-hello-world/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 21:00:47 +0000</pubDate>
		<dc:creator>Greg R. Jacobs</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[c sharp]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=28702</guid>
		<description><![CDATA[In this tutorial we are going to get up close with the Visual Studio 2010 environment. We will learn how to make a console application as well as a form to display our hello world applications.  This will give us an opportunity to view 2 types of solutions of the many available in Visual Studio. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=28702&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div style="text-align:center;">
<p id="internal-source-marker_0.4662012970075011"><img class="alignnone size-full wp-image-28788" title="cworld" src="http://hackadaycom.files.wordpress.com/2010/09/cworld.jpg" alt="" width="457" height="120" /></p>
</div>
<p>In this tutorial we are going to get up close with the Visual Studio 2010 environment. We will learn how to make a console application as well as a form to display our hello world applications.  This will give us an opportunity to view 2 types of solutions of the many available in Visual Studio.  We will start making the console application first then progress to the forms application.</p>
<p>First we must  understand the development environment we are going to use.  On the far left side is the toolbox panel.  This panel gives us access to a lot of controls  that can be used by the Windows Forms.  Next is the Solution Explorer that will allow us to navigate the projects and files we are going to create in this Solution.  The Properties panel is directly under my Solution Explorer and will allow us to change properties of controls and of the form we will create later on.  If any of these are not being displayed they can be retrieved from the View menu at the top under Other Windows.  For more information on the Visual Studio IDE visit <a href="http://bit.ly/VSIDEHelp">MSDN </a>and search for the specific questions you are having.</p>
<p><span id="more-28702"></span></p>
<p style="text-align:center;"><a href="http://hackadaycom.files.wordpress.com/2010/09/visualstudioide.png"><img class="size-thumbnail wp-image-28703 alignnone" title="VisualStudioIDE" src="http://hackadaycom.files.wordpress.com/2010/09/visualstudioide.png?w=128&#038;h=69" alt="" width="128" height="69" /></a></p>
<p>Then we need to start the Visual Studio environment and create a new project.  To do this we will go to File then navigate to New Project and click it.  A dialog box will appear and ask you which project you would like to include in your solution that will be automatically created for your project.  We need to use the Console Application.  Next we need to replace the box at the bottom where it says <strong>ConsoleApplication1 </strong>with <strong>HelloWorldConsole </strong>and then after the project and solution is created press <em>CTRL-S</em> to change the name of the solution file to <strong>HelloWorld</strong> in the box under the project name box and press <strong>OK</strong>.  This will create a project inside a Solution file. The solution file acts like the glue that binds all projects included in the solution file together.  Later on we will discover how this is beneficial for creating projects and making class files that reference DLL’s that we will code.</p>
<p>Once the project is created we are going to edit the program.cs file.  After you have open the program.cs we are going to add the text necessary to have the program output “Hello World” to the console.  To do this we will need to add the line <strong>Console.Out.WriteLine(&#8220;Hello World!&#8221;); </strong>inside the static void main curly brackets.  After this is complete we can now build and attempt to build our solution.  To build the solution we need to press <em>CTRL + SHIFT + B </em>and the build process will being.  After the build is a success we can now run the Console Application by pressing <em>CTRL + F5.</em> This will display a command prompt with “Hello World!”.</p>
<p style="text-align:center;"><a href="http://hackadaycom.files.wordpress.com/2010/09/helloworldconsole.png"><img class="aligncenter size-thumbnail wp-image-28704" title="HelloWorldConsole" src="http://hackadaycom.files.wordpress.com/2010/09/helloworldconsole.png?w=128&#038;h=64" alt="" width="128" height="64" /></a></p>
<p>Here is the source code for <em>program.cs:</em></p>
<p><pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloWorldConsole
{
class Program
{
static void Main(string[] args)
{
Console.Out.WriteLine(&quot;Hello World!&quot;);
}
}
}

</pre></p>
<p>We can now move on to the windows forms application of Hello World.  To do this, we need to go to the solution and<strong> Right Click</strong>, then go to <strong>Add </strong>then click <strong>New Project</strong>.  For the project we will name it <strong>HelloWorldForms</strong>.  After the project is created we are going to delete the <em>Form1.cs</em> and we are going to create a new form by Right Clicking the HelloWorldForms Project, Navigating to <strong>Add</strong> then to <strong>New Item</strong>,  and when the dialog box appears we are going to pick <strong>Windows Form</strong>.</p>
<p>The name we are going to use is<em> main.cs</em> and press <strong>Add</strong>.  We now edit the <em>program.cs</em> to change the <strong>Form1</strong> that can be found in the file to <strong>main</strong>.  After the Windows Form is created we can start adding in Controls from the Toolbox.<br />
We are going to drag a label and a button onto the form portrayed in the middle of the program.  We are going to edit the properties here to make the text inside the label blank and the name of the label <strong>lbHelloWorld </strong>instead of <strong>label1</strong>.  After this is done we are going to want to edit the button we dropped onto the form earlier.  We will change the name of the button to <strong>btnHelloWorld </strong>and the Text of the button to <strong>Click Me!</strong>.  After this is done we are going to want to use an event handler to tie the button and the label together, so when the button is clicked “Hello World!” will appear in the label.</p>
<p>To make an event handler for the button we are going to go to the Properties panel and click the button on the top that looks like a lightning bolt.  This will take us to all o the event handlers that this button can handle.  We want the Click event handler, this will create the code required to handle a click event in the <em>main.cs</em>.  Now that the wrapper is there we can code the output to the label when the button is clicked.  Inside the curly brackets of “<strong>private void btnHelloWorld_Click</strong>” in<em> main.cs</em> input the following line of code to link the two Controls:</p>
<p><pre class="brush: csharp;">

lbHelloWorld.Text = “Hello World!”;

</pre></p>
<p>This will make the <em>main.cs</em> look like this:</p>
<p><pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HelloWorldForms
{
 public partial class main : Form
 {
 public main()
 {
 InitializeComponent();
 }

 private void btnHelloWorld_Click(object sender, EventArgs e)
 {
 lbHelloWorld.Text = &quot;Hello World!&quot;;
 }
 }
}
</pre></p>
<p>The <em>program.cs</em> should look like this:</p>
<p><pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace HelloWorldForms
{
 static class Program
 {
 /// &lt;summary&gt;
 /// The main entry point for the application.
 /// &lt;/summary&gt;
 [STAThread]
 static void Main()
 {
 Application.EnableVisualStyles();
 Application.SetCompatibleTextRenderingDefault(false);
 Application.Run(new main());
 }
 }
}
</pre></p>
<p>After all of this is completed we need to run the program by pressing <em>CTRL + F5</em> again. The screen that should appear should be something like this:</p>
<p style="text-align:center;"><a href="http://hackadaycom.files.wordpress.com/2010/09/helloworldformunclicked.png"><img class="aligncenter size-thumbnail wp-image-28705" title="HelloWorldFormUnclicked" src="http://hackadaycom.files.wordpress.com/2010/09/helloworldformunclicked.png?w=96&#038;h=96" alt="" width="96" height="96" /></a></p>
<p>The screen after the button has been pressed should look like this:</p>
<p style="text-align:center;"><a href="http://hackadaycom.files.wordpress.com/2010/09/helloworldformclicked.png"><img class="aligncenter size-thumbnail wp-image-28706" title="HelloWorldFormclicked" src="http://hackadaycom.files.wordpress.com/2010/09/helloworldformclicked.png?w=96&#038;h=96" alt="" width="96" height="96" /></a></p>
<p>Now that we have completed the next tutorial you should be able to move through the Visual Studio IDE to make multiple projects under one solution, delete files within a project and create new forms and classes, and modify source code within event handlers.  The next tutorial will go more in depth with the Visual Studio Toolbox and make a form with controls on it with minimal backbone code, as well as review some of the common files created and what is automatically included for you.  For more information on Toolbox Controls you can check out <a href="http://bit.ly/ToolboxMSDN">Microsoft MSDN </a>article on Toolbox Controls. If you are having any trouble with this project feel free to comment and I will help to try and resolve the issue.  Until next tutorial, Happy Hacking!</p>
<br />Filed under: <a href='http://hackaday.com/category/news/'>news</a>, <a href='http://hackaday.com/category/software-development/'>Software Development</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/28702/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/28702/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/28702/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/28702/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/28702/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/28702/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/28702/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/28702/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=28702&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/09/30/c-sharp-development-101-part-1-hello-world/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		<georss:point>43.002684 -81.214990</georss:point>
		<geo:lat>43.002684</geo:lat>
		<geo:long>-81.214990</geo:long>
		<media:content url="" medium="image">
			<media:title type="html">greggers120588</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/cworld.jpg" medium="image">
			<media:title type="html">cworld</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/visualstudioide.png?w=128" medium="image">
			<media:title type="html">VisualStudioIDE</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/helloworldconsole.png?w=128" medium="image">
			<media:title type="html">HelloWorldConsole</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/helloworldformunclicked.png?w=96" medium="image">
			<media:title type="html">HelloWorldFormUnclicked</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/helloworldformclicked.png?w=96" medium="image">
			<media:title type="html">HelloWorldFormclicked</media:title>
		</media:content>
	</item>
		<item>
		<title>C Sharp Development 101 &#8211; A Tutorial Series</title>
		<link>http://hackaday.com/2010/09/03/c-sharp-development-101-a-tutorial-series/</link>
		<comments>http://hackaday.com/2010/09/03/c-sharp-development-101-a-tutorial-series/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 20:00:49 +0000</pubDate>
		<dc:creator>Greg R. Jacobs</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[c sharp]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=27935</guid>
		<description><![CDATA[In this tutorial series we are going to look at C# Development using the Visual Studio 2010 Express editions.  This will take you from the basics of installing Visual Studio 2010 Express, to the Object Oriented Programming style associated with C# and other languages, dabble in some database access (Access &#38; SQL Server Express) and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=27935&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;"><img class="alignnone size-full wp-image-27962" title="cdev" src="http://hackadaycom.files.wordpress.com/2010/09/cdev.jpg" alt="" width="457" height="120" /></p>
<div>In this tutorial series we are going to look at C# Development using the Visual Studio 2010 Express editions.  This will take you from the basics of installing Visual Studio 2010 Express, to the Object Oriented Programming style associated with C# and other languages, dabble in some database access (Access &amp; SQL Server Express) and finally, design a project that will pull all of our knowledge together into a final solution.</div>
<div><span id="more-27935"></span></div>
<div>
<p>We are going to begin by downloading the Visual Studio 2010 express from Microsoft&#8217;s <a href="http://bit.ly/VS2010Express">website </a>so that we can get started on some C# development.  After the file has been downloaded you will need to have a connection to the Internet so that the program can download the necessary files to complete the install.  For the sake of customization we won’t walk through the rest of the install and will pick up with some add-ons that will make your coding experience easier.</p>
<p>With the Express edition now installed, it is good to know that the express editions of Visual Studio 2010 do not support extensibility.  This means that the ability to install plug-ins and add-ons is not included.  If you happen to acquire or have a full version of Visual Studio 2010 then the option is there for you to add these plug-ins that have helped me out in a tough spot before.</p>
<ul>
<li><a href="http://bit.ly/WholeTomato">Visual Assist X</a>
<ul>
<li>This is probably one of the best applications out there for intellisense and document syntax highlighting.  Now many of you might be saying that Visual Studio already does this.  Yes they do, but not as well as Visual Assist X.  This add-on will look into your added in files such as the Boost library, and retrieve all of the Boost functions and try and piece together a description of what that particular function would do.  Syntax highlighting is the best around with the quick option to do minimal to maximum highlighting.  A must have for the avid programmer but will run you $249 for a one year subscription and $49 maintenance fee every year afterwards.  This price tag might discourage most but take the 30 day trial and take it for a test run.</li>
</ul>
</li>
</ul>
</div>
<p style="text-align:center;"><a href="http://hackadaycom.files.wordpress.com/2010/09/wtslogogray.gif"><img class="alignnone size-full wp-image-27950" title="wtsLogoGray" src="http://hackadaycom.files.wordpress.com/2010/09/wtslogogray.gif" alt="" width="212" height="33" /></a></p>
<p style="text-align:center;">
<div>
<ul>
<li><a href="http://bit.ly/GhostDoc">Ghost Doc</a>
<ul>
<li>A product of SubMain, this add-on will allow you to document your code quickly and efficiently using XML markup.  To generate these comments it uses the elements type, parameters of the function as well as its name to generate the comment.  This is especially useful for people who do not enjoy documenting functions in their code.   Most promising add-on if you are looking for code documentation.</li>
</ul>
</li>
</ul>
</div>
<p style="text-align:center;"><img src="http://www.roland-weigelt.de/blog/images/2007/20071125_GhostDoc.png" alt="" /></p>
<div>
<ul>
<li><a href="http://bit.ly/Ankh_SVN">AnkhSVN</a>
<ul>
<li>A free SVN add-in for Visual Studio that allows you to connect to a repository, browse the branches all within the comfort of the Visual Studio environment.  Very easy to use for people who want to start a community project on Google Code or host their own.  A must have for people who like to collaborate and don’t want to hover over one persons computer to review code.</li>
</ul>
</li>
</ul>
</div>
<p style="text-align:center;"><img src="http://ankhsvn.open.collab.net/images/ankhsvn-logo.png" alt="AnkhSVN logo" /></p>
<p style="text-align:center;">
<div>All of these have been personally used and are highly recommended for use when developing for the .NET framework.  The next part in this series will go back to an old classic for programmers; Hello World.  We will go through making a project file and printing Hello World to the console as well as on a form.  As always, any problems with the series or if you just have questions post to the comments so that we may learn from each others mistakes and grow as a community.  If you can’t wait until the next post, <a href="http://bit.ly/CSharpHelloWorld">here</a> is how to start making a Hello World console app.  Until next time, Happy Hacking!</div>
<br />Filed under: <a href='http://hackaday.com/category/software-development/'>Software Development</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/27935/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/27935/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/27935/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/27935/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/27935/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/27935/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/27935/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/27935/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=27935&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/09/03/c-sharp-development-101-a-tutorial-series/feed/</wfw:commentRss>
		<slash:comments>107</slash:comments>
		<georss:point>43.002684 -81.214990</georss:point>
		<geo:lat>43.002684</geo:lat>
		<geo:long>-81.214990</geo:long>
		<media:content url="" medium="image">
			<media:title type="html">greggers120588</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/cdev.jpg" medium="image">
			<media:title type="html">cdev</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/09/wtslogogray.gif" medium="image">
			<media:title type="html">wtsLogoGray</media:title>
		</media:content>

		<media:content url="http://www.roland-weigelt.de/blog/images/2007/20071125_GhostDoc.png" medium="image" />

		<media:content url="http://ankhsvn.open.collab.net/images/ankhsvn-logo.png" medium="image">
			<media:title type="html">AnkhSVN logo</media:title>
		</media:content>
	</item>
		<item>
		<title>Software Auralization</title>
		<link>http://hackaday.com/2009/10/08/software-auralization/</link>
		<comments>http://hackaday.com/2009/10/08/software-auralization/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 13:20:59 +0000</pubDate>
		<dc:creator>Phil Burgess</dc:creator>
				<category><![CDATA[digital audio hacks]]></category>
		<category><![CDATA[auralization]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=16902</guid>
		<description><![CDATA[Have you heard the latest track by gzip? Maybe it’ll end up on a “Greatest Hits” album alongside Philip Glass. Visualization techniques such as animated algorithms can help programmers better grasp the abstract theories that make software work. Could auralization, the sound equivalent of visualization, provide similar insights? Postgrad student (and J. S. Bach fan) [Cessu] developed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=16902&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;">
<p><img class="alignnone size-full wp-image-16914" title="music" src="http://hackadaycom.files.wordpress.com/2009/10/music.gif" alt="music" width="470" height="180" /></p>
<p>Have you heard the latest track by <em>gzip?</em> Maybe it’ll end up on a “Greatest Hits” album alongside Philip Glass.</p>
<p>Visualization techniques such as <a href="http://www.sorting-algorithms.com/">animated algorithms</a> can help programmers better grasp the abstract theories that make software work. Could <em>auralization,</em> the sound equivalent of visualization, provide similar insights? Postgrad student (and J. S. Bach fan) [Cessu] <a href="http://cessu.blogspot.com/2008/09/have-you-listened-to-your-program-today.html">developed a program to do just that</a>. By carefully mapping registers to notes, and slowing the tempo to a human timescale, the result is a cacophonous machine that offers a glimpse into the operation of various programs. You might find the resulting minimalist “music” insightful, entertaining…or maybe just incredibly grating.</p>
<p>[thanks Shadikka]</p>
<br />Posted in digital audio hacks  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/16902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/16902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/16902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/16902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/16902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/16902/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/16902/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/16902/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=16902&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/10/08/software-auralization/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">philburgess</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/10/music.gif" medium="image">
			<media:title type="html">music</media:title>
		</media:content>
	</item>
	</channel>
</rss>
