<?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/"
	>

<channel>
	<title>ntsdt.net &#187; Uncategorized</title>
	<atom:link href="http://ntsdt.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://ntsdt.net</link>
	<description>never the same day twice</description>
	<lastBuildDate>Wed, 02 Jun 2010 16:35:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>apple ipad &#8211; it&#8217;s what it will lead to that&#8217;s important</title>
		<link>http://ntsdt.net/2010/01/28/apple-ipad-its-what-it-will-lead-to-thats-important/</link>
		<comments>http://ntsdt.net/2010/01/28/apple-ipad-its-what-it-will-lead-to-thats-important/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 01:32:20 +0000</pubDate>
		<dc:creator>lukus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[ipad]]></category>

		<guid isPermaLink="false">http://ntsdt.net/?p=299</guid>
		<description><![CDATA[I think, when we look back in 10 years time, people are going to be able to say that the &#8216;ipad&#8217; was a very big deal.
Initially, like most other people, I was disappointed.  The specification &#8211; the limited OS.  These things aren&#8217;t ideal.  The only saving grace was the cost.  It&#8217;s affordable.  I was undecided [...]]]></description>
			<content:encoded><![CDATA[<p>I think, when we look back in 10 years time, people are going to be able to say that the &#8216;ipad&#8217; was a very big deal.</p>
<p>Initially, like most other people, I was disappointed.  The specification &#8211; the limited OS.  These things aren&#8217;t ideal.  The only saving grace was the cost.  It&#8217;s affordable.  I was undecided about whether this new device could be a winner.</p>
<p>But, I started to think about it in a bit more detail a little later on, and while on my evening run &#8211; it struck me.</p>
<p>This device will be revolutionary &#8211; not for what it is now.  But for what it will lead to.  I&#8217;m certain of it.</p>
<p>Optimistically, I think this device represents a new way of living with computing.  At the moment &#8211; for most people &#8211; their experience of computing is something that&#8217;s an especially segmented activity.</p>
<p>Using the computer is an activity that usually breaks the flow of our other activities&#8230;  &#8220;I&#8217;m just going to go on the computer for half an hour&#8221;, &#8220;I need to go and check my email&#8221; .. these are things people say all the time.  We think of a computer as an object that we spend time with.  Even in 2010, the way we interact with computers at home is pretty much the same as it was in 1980s.</p>
<p>It doesn&#8217;t have to be this way &#8211; and I&#8217;d be willing to bet that in the future, it won&#8217;t be.  But in order to make the transition, new ways of integrating a computer into our lives need to be developed.</p>
<p>The reason that the ipad is going to be revolutionary is because it&#8217;s a blank slate &#8211; a computing device for completely new contexts.  No matter what you think of it, I think we can probably rest assured that it will work pretty well &#8211; and that many developers are going to come up with a huge range of ingenious uses for it.</p>
<p>I think that it should be seen as a prototype, and as an experiment.  The form of the device provides many, new exciting possibilities.</p>
<p>Other companies will copy, material costs will become cheaper, even cheaper devices will be produced.  The public&#8217;s perception of what computer is, will start to change.  Cheap flexible displays and e-ink will become the norm.  Computers are going to start to inhabit our environment more seamlessly.  The way we use computers will integrate into our lives and workflows more sympathetically.</p>
<p>I reckon the ipad will move this all of this forward a great deal.</p>
]]></content:encoded>
			<wfw:commentRss>http://ntsdt.net/2010/01/28/apple-ipad-its-what-it-will-lead-to-thats-important/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>programming an atmega8 using arduino</title>
		<link>http://ntsdt.net/2009/08/07/programming-an-atmega8-using-arduino/</link>
		<comments>http://ntsdt.net/2009/08/07/programming-an-atmega8-using-arduino/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 20:44:42 +0000</pubDate>
		<dc:creator>lukus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[atmega]]></category>
		<category><![CDATA[avrdude]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[programmer]]></category>

		<guid isPermaLink="false">http://ntsdt.net/?p=184</guid>
		<description><![CDATA[The ATmega8/168/328 are a range of microprocessors at the heart of the Arduino.  Rather than having to include an external Arduino board with my projects, I&#8217;d like to be able to create self-contained devices which have the ATmega chip embedded.
Programming the ATmega
It&#8217;s possible to program Atmel microprocessors using an Arduino board and the megaISP [...]]]></description>
			<content:encoded><![CDATA[<p>The ATmega8/168/328 are a range of microprocessors at the heart of the Arduino.  Rather than having to include an external Arduino board with my projects, I&#8217;d like to be able to create self-contained devices which have the ATmega chip embedded.</p>
<h3>Programming the ATmega</h3>
<p>It&#8217;s possible to program Atmel microprocessors using an Arduino board and the megaISP project.  This post documents my attempt.</p>
<p><span id="more-184"></span></p>
<p>Before starting of got hold of a copy of the datasheet for the ATmega8 (<a href="http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf)" target="_blank">http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf</a>)</p>
<h3>Step 1: Upload mega-isp to Arduino</h3>
<p>I downloaded the mega-isp source, and uploaded it to my Arduino board.  The source can be found at google code (<a href="http://code.google.com/p/mega-isp/" target="_blank">http://code.google.com/p/mega-isp/</a>).</p>
<h3>Step 2: Set up breadboard</h3>
<div class="wp-caption alignleft" style="width: 510px"><img title="mega-isp: programming an atmega8 with arduino" src="http://farm3.static.flickr.com/2447/3798709025_dc18d9e25a.jpg" alt="mega-isp: programming an atmega8 with arduino" width="500" height="375" /><p class="wp-caption-text">mega-isp: programming an atmega8 with arduino</p></div>
<p>First of all, I set up the breadboard according the advice given at <a href="http://www.uchobby.com/index.php/2007/11/04/arduino-avr-in-system-programmer-isp/" target="_blank">http://www.uchobby.com/index.php/2007/11/04/arduino-avr-in-system-programmer-isp/</a></p>
<p>The article mentions something called a bypass capacitor .. which is something I hadn&#8217;t come across before.  Basically, it&#8217;s a small capacitor that&#8217;s used to smooth out small changes in voltage &#8211; and should be used whenever you set up a microprocessor in a circuit.  I learnt about them here (<a href="http://www.seattlerobotics.org/Encoder/jun97/basics.html" target="_blank">http://www.seattlerobotics.org/Encoder/jun97/basics.html</a>)</p>
<p>Because I&#8217;m trying to program an ATmega8 (and not the Tiny18 mentioned in the  article) I needed to adjust the pins.  I also added another LED to signal when megaisp is actually programming (which was mentioned in the Arduino source code).</p>
<div id="attachment_232" class="wp-caption alignright" style="width: 310px"><img class="size-medium wp-image-232 " title="ATMEGA8.pinconfig" src="http://ntsdt.net/wp-content/uploads/2009/08/ATMEGA8.pinconfig-300x273.png" alt="ATmega8/168/328p pinout diagram" width="300" height="273" /><p class="wp-caption-text">ATmega8/168/328p pinout diagram</p></div>
<p>The only pins that I needed to consider were:</p>
<table border="0">
<tbody>
<tr>
<th colspan="3"><strong>The SPI interface</strong></th>
</tr>
<tr>
<td>ATMEGA-PIN19</td>
<td>⇔</td>
<td>ARDUINO-PIN13(SCK)</td>
</tr>
<tr>
<td>ATMEGA-PIN18</td>
<td>⇔</td>
<td>ARDUINO-PIN12(MISO)</td>
</tr>
<tr>
<td>ATMEGA-PIN17</td>
<td>⇔</td>
<td>ARDUINO-PIN11(MOSI)</td>
</tr>
<tr>
<th colspan="3"><strong>Power / Gnd</strong><br />
(I added a bypass capacitor between 7/22 on the atmega)</th>
</tr>
<tr>
<td>ATMEGA-PIN8</td>
<td>⇔</td>
<td>ARDUINO-GND</td>
</tr>
<tr>
<td>ATMEGA-PIN22</td>
<td>⇔</td>
<td>ARDUINO-GND</td>
</tr>
<tr>
<td>ATMEGA-PIN7</td>
<td>⇔</td>
<td>ARDUINO-5V</td>
</tr>
<tr>
<td>ATMEGA-PIN20</td>
<td>⇔</td>
<td>ARDUINO-5V</td>
</tr>
<tr>
<th colspan="3"><strong>Reset</strong></th>
</tr>
<tr>
<td>ATMEGA-PIN1</td>
<td>⇔</td>
<td>ARDUINO-PIN10</td>
</tr>
<tr>
<th colspan="3"><strong>Status LEDs</strong><br />
(each connected to ground via a resistor)</th>
</tr>
<tr>
<td>heartbeat LED</td>
<td>⇔</td>
<td>ARDUINO-PIN9</td>
</tr>
<tr>
<td>error LED</td>
<td>⇔</td>
<td>ARDUINO-PIN8</td>
</tr>
<tr>
<td>programming LED</td>
<td>⇔</td>
<td>ARDUINO-PIN7</td>
</tr>
</tbody>
</table>
<h3>Step 3: Connecting via AVRdude</h3>
<p><a href="http://savannah.nongnu.org/projects/avrdude/" target="_blank">AVRdude</a> is an open-source utility for programming Atmel AVR Microcontrollers.</p>
<p>Running the following from a terminal</p>
<pre class="code">avrdude -p atmega8 -c avrisp -P /dev/ttyUSB0 -b 19200</pre>
<p>produced</p>
<pre class="code">avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.13s

avrdude: Device signature = 0x1e9307

avrdude: safemode: Fuses OK

avrdude done.  Thank you.</pre>
<p>Which indicated that AVRdude had communicated  with the mega-isp successfully.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 684px; width: 1px; height: 1px;">&amp;hArr;</div>
]]></content:encoded>
			<wfw:commentRss>http://ntsdt.net/2009/08/07/programming-an-atmega8-using-arduino/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>the future of fonts on the web</title>
		<link>http://ntsdt.net/2009/06/30/the-future-of-fonts-on-the-web/</link>
		<comments>http://ntsdt.net/2009/06/30/the-future-of-fonts-on-the-web/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:55:20 +0000</pubDate>
		<dc:creator>lukus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[digital rights]]></category>
		<category><![CDATA[intellectual property]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[webfonts]]></category>
		<category><![CDATA[www-style]]></category>

		<guid isPermaLink="false">http://blog.ntsdt.net/?p=123</guid>
		<description><![CDATA[I&#8217;ve been reading the discussion about webfonts on the www-style@w3.org mailing lists. There&#8217;s been quite a lot of activity lately about the future of fonts on the web.
Basically it seems that four major browsers manufacturers are happy to roll out new versions of their apps which implement the &#8216;@font-face&#8217; method.
The font foundries themselves are not [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading the discussion about webfonts on the www-style@w3.org mailing lists. There&#8217;s been quite a lot of activity lately about the future of fonts on the web.</p>
<p>Basically it seems that four major browsers manufacturers are happy to roll out new versions of their apps which implement the &#8216;@font-face&#8217; method.</p>
<p>The font foundries themselves are not happy with this because it might make it easy for users to steal fonts. Microsoft won&#8217;t use it because the font foundries object &#8211; and they&#8217;ve been championing their own format (EOT) for sometime now. (The WEFT stuff you link to, is an early implementation of this). They submitted the idea as freebie to the W3C but I afaik it was turned down.</p>
<p><span id="more-123"></span>So right now, there are a load of people arguing about a possible solution (three main camps .. the open-source browsers, Microsoft, and some reps from some of the major font-foundries).</p>
<p>The battle seems to revolve around how to appease the font foundries. (e.g. the font companies don&#8217;t want people visiting websites and stealing fonts from their computer&#8217;s temp directory).</p>
<p>Lots of different methods have been suggested &#8211; most try to deal with the problem by either obfuscation or compression. So font-files would either be placed in some-kind of wrapper (e.g. EOT) or compressed using some kind of proprietary format (Monotype want their own format MXT to be used), or maybe changing the font-file&#8217;s meta-data in some obscure way which would make the font unusable in desktop applications.</p>
<p>I reckon the main problem is that the argument is philosophical as well as practical. Microsoft are closed-source and don&#8217;t like co-operating and giving away their code&#8230; the open-source guys are religiously opposed to Microsoft&#8217;s stance and it seems that some font-foundries ideally want to implement DRM for fonts which is as a daft as King Canute trying to turn back the tide.</p>
<p>While there are doubtlessly better ways to spend time, it&#8217;s been pretty interesting following these developments. I had no idea how these things were decided before I joined these w3.org mailing lists&#8230; now I can see just how tortuous the process is.</p>
<p>And right now it seems like they&#8217;re all very very pissed off.</p>
]]></content:encoded>
			<wfw:commentRss>http://ntsdt.net/2009/06/30/the-future-of-fonts-on-the-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RIP MJ</title>
		<link>http://ntsdt.net/2009/06/27/rip-mj/</link>
		<comments>http://ntsdt.net/2009/06/27/rip-mj/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 14:57:13 +0000</pubDate>
		<dc:creator>lukus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[michael jackson]]></category>

		<guid isPermaLink="false">http://blog.ntsdt.net/?p=56</guid>
		<description><![CDATA[When I was growing up, I had a mate who was totally fixated on MJ&#8217;s dance moves.. he&#8217;d spend so much time perfecting them.  My sister&#8217;s very first album was &#8216;off the wall&#8217;.  My next door neighbour&#8217;s Mum had the MJ tour video &#8211; and I used to sit in their living room, [...]]]></description>
			<content:encoded><![CDATA[<p>When I was growing up, I had a mate who was totally fixated on MJ&#8217;s dance moves.. he&#8217;d spend so much time perfecting them.  My sister&#8217;s very first album was &#8216;off the wall&#8217;.  My next door neighbour&#8217;s Mum had the MJ tour video &#8211; and I used to sit in their living room, watching it for hours at a time. School discos would always involve MJs music.</p>
<p>Then, when I was older &#8211; I&#8217;d dance to the Jackson Five every week at the local indie club&#8230; then when I was older still I&#8217;d dance to Billy Jean at Trash.</p>
<p>He symbolised and summed up an entire generation far more succinctly than anything else I can think of.</p>
<p>Cassette tapes and walkman, the chart show &#8211; top of the pops&#8230; those 30min music video feature specials that premiered with each big release.  In one way or another my entire youth can be related to Michael Jackson.  He symbolised the American dream &#8211; consumerism, and triumphant capitalism .. but he also made damn good tunes, which were instantly attractive.  Because his music was always there, as a backdrop, I didn&#8217;t always pay total attention.  But now that he&#8217;s gone, it really feels like the world is lacking something I didn&#8217;t realise was so important.</p>
]]></content:encoded>
			<wfw:commentRss>http://ntsdt.net/2009/06/27/rip-mj/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>first steps with atmel assembly</title>
		<link>http://ntsdt.net/2008/08/08/first-steps-with-atmel-assembly/</link>
		<comments>http://ntsdt.net/2008/08/08/first-steps-with-atmel-assembly/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 01:26:57 +0000</pubDate>
		<dc:creator>lukus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[assembly language]]></category>
		<category><![CDATA[atmega]]></category>
		<category><![CDATA[atmel]]></category>
		<category><![CDATA[avr studio]]></category>
		<category><![CDATA[electronics]]></category>

		<guid isPermaLink="false">http://blog.ntsdt.net/?p=85</guid>
		<description><![CDATA[I&#8217;ve been experimenting with Arduino for quite a while and have had a lot of fun using it.  Arduino is an open-source hardware platform which has become very popular with digital-artists, hardware-hackers and people interested in finding ways to make computing more physical.
While the Arduino IDE is suitable for most tasks, there are times [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with Arduino for quite a while and have had a lot of fun using it.  Arduino is an open-source hardware platform which has become very popular with digital-artists, hardware-hackers and people interested in finding ways to make computing more physical.</p>
<p>While the Arduino IDE is suitable for most tasks, there are times when more granular control over the way that the ATMega microprocessor executes instructions is useful.  This is where an understanding of Atmel&#8217;s assembly language comes in handy.</p>
<p><span id="more-85"></span>To be honest, I initially thought that assembly language would involve concepts that my brain would have a lot of difficulty comprehending.  Luckily (for me) the process turned out to be far simpler than I initially imagined, and I was able to start using Atmel Assembly last night.  I decided to post my experiences here in case it helps anyone else (and to cement the info in my own mind).  Thanks go to a guy called eadthem on #freenode irc for help and guidance.</p>
<div id="attachment_229" class="wp-caption alignleft" style="width: 778px"><img class="size-full wp-image-229" title="atmega8" src="http://ntsdt.net/wp-content/uploads/2008/08/atmega8.jpg" alt="ATmega8 Microprocessor" width="768" height="576" /><p class="wp-caption-text">ATmega8 Microprocessor</p></div>
<h3>AVR Studio</h3>
<p>One of the great things about the ATmega chip (which is the family of microprocessor chips at the heart of the Arduino platform) is the range of free development tools which it&#8217;s parent company Atmel provides. In this case, I used an IDE called AVR Studio 3.5 (<a href="http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2724" target="_blank">http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2724</a>)</p>
<p>As I run linux, I needed to use wine to run AVR Studio.  There wasn&#8217;t any problem doing so.  Wine decompresses to a folder in the fake &#8216;windows/temp&#8217; directory&#8230;. you simply need to navigate and open &#8216;~/.wine/drive_c/windows/temp/cdrom/SETUP.EXE&#8217; which runs and completes the installation process.  After installation, Atmel Studio was available in application menu (Applications -&gt; Wine -&gt; Programs-&gt;Atmel AVR Tools-&gt;AVR Studio 3.56).</p>
<h3>Obtaining Supporting Documentation</h3>
<p>There are various versions of the ATmega chip in production &#8211; and each has a different range of capabilities associated with it. I&#8217;m using an Atmega8 microprocessor, so it was important that I made sure I had the relevant datasheet at hand and the AVR 8-bit Instruction Set documents.  You can find these via the links below.</p>
<p>[*1] (<a href="http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf" target="_blank">http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf</a>)</p>
<p>[*2] (<a href="http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf" target="_blank">http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf</a>) &lt;- pages 10 to 14 are especially relevant.</p>
<h3>Setting up the Project</h3>
<p>Okay, first task was to set-up a new project in AVR Studio.</p>
<pre class="code">Project -&gt; new -&gt; [give it a name] / [pick AVR assembler].</pre>
<p>This creates a blank project.  Next we need a new text file to put our assembly code.</p>
<pre class="code">File -&gt; new text file -&gt; [give it the name 'main.asm']</pre>
<p>As far as I know, the name isn&#8217;t important &#8211; what <strong><em>is</em></strong> important is that when you right click this file, &#8216;assembler entry file&#8217; is ticked.  You also need to drag this file into the Assembler Files folder.</p>
<p>Next, right click the route node of the project, and select the &#8216;project settings&#8217;.  Change the output file format to &#8216;intel hex&#8217;.  This defines the format that will eventually be used by the programmer software / board to upload the code to the microprocessor.</p>
<h3>Writing the Code</h3>
<p>Okay &#8211; next step is to produce the required code.</p>
<p>Open up the text file created a few steps ago.</p>
<p>The very first stage involves setting the start point in your program memory, to hex address 3A.  You need to add the following line at the begining of this newly opened file.</p>
<pre class="code">.ORG $3A</pre>
<p>and then continue to add the following lines of code &#8230;</p>
<pre class="code">START:	LDI	r16,high(ramend)	;ramend=$025F p7-9
	OUT	sph,r16
	LDI	r16,low(ramend)
	OUT	spl,r16</pre>
<p>It&#8217;s worth running through some of the conventions here.</p>
<ul>
<li> The word preceding the colon, defines a point in the program code which can be called or jumped to later on. This is then used to enable us to call subroutines and create loops.</li>
<li> The semicolon defines a comment.</li>
<li> LDI and OUT are instructions &#8230; (a full list of the AVR instruction set can be found in the guide linked above [*2], pages 10-14)</li>
<li> r16 is a register.  Registers can be though of as internal variables, which are able to be accessed very quickly by the processor; some are specific and can only be used in certain circumstances, while others are general purpose.</li>
<li> sph and spl refer to the AVR stack pointer (which is implemented as two 8-bit registers). The stack is a stack of data &#8211; you can add (push) data to the stack, or take (pop) data from the stack.  Find out more about the stack on page 13 of [*1].</li>
<li> As far as I can tell ramend, is a device specific constant, which refers to the end of the available data RAM.</li>
</ul>
<p>For this first program, I simply wanted to make an LED flash.  To do this, I need to output a HIGH signal followed by a LOW signal to one of the ports on the ATmega.</p>
<p>I was a bit confused here, thinking that port is another word for pin&#8230; it isn&#8217;t.  The Atmega8 has three ports labelled BCD which are responsible for looking after 23 IO general purpose IO lines/pins.</p>
<dl>
<dt> Port B </dt>
<dd> looks after 8 I/O lines (PB7-0) </dd>
<dt> Port C </dt>
<dd> looks after 7 I/O lines (PC6-0) &#8230; but note that PC6 is special case and is different to others, it&#8217;s used as an IO pin or reset see page 5 of [*1] for more info. </dd>
<dt> Port D </dt>
<dd> looks after 8 I/O lines (PD7-0) </dd>
</dl>
<p>Each port pin consists of three register bits ( DDxn, PORTxn, PINxn).  By using a bit of cleverness, all the required physical ports can be accessed through address lookups.</p>
<ul>
<li> DDxn bits are accessed at the DDRx I/O address,</li>
<li> PORTxn bits are accessed at the PORTx I/O address</li>
<li> PINxn bits are accessed at the PINx I/O address.</li>
</ul>
<p>(N/B Page 65 of [*1] is a useful overview of how data is output (PORTxn), how pin direction is defined (DDRxn) and where input data is stored/accessed (PINxn), in relation to the available ports and pins.)</p>
<p>Because the ports and IO lines/pins are general purpose, we need to be able to define which are used for input and which are used for output.  This is done by setting the port direction.</p>
<pre class="code">	LDI r18,0b10000000
	OUT ddrb,r18</pre>
<p>LDI is the instruction for &#8216;load immediate&#8217;, OUT is the instruction for &#8216;out to i/o location&#8217;.</p>
<p>Next, we preload registers r18 and r19 with the data that we&#8217;ll use to make our LED flash&#8230; because we use these values many times, the assignment happens before the main loop.</p>
<pre class="code">	LDI r18,0b10000000; set register to pin 7 high
	LDI r19,0b00000000; set register to all pins low</pre>
<p>Then we can add the main loop &#8230;</p>
<pre class="code">MAINLOOP:
	out portb,r18
	out portb,r19
	jmp MAINLOOP</pre>
<div id="attachment_203" class="wp-caption alignright" style="width: 310px"><a href="http://ntsdt.net/wp-content/uploads/2008/08/avrstudio_screenshot1.gif"><img class="size-medium wp-image-203" title="avrstudio_screenshot1" src="http://ntsdt.net/wp-content/uploads/2008/08/avrstudio_screenshot1-300x220.gif" alt="AVR Studio Screenshot" width="300" height="220" /></a><p class="wp-caption-text">AVR Studio Screenshot</p></div>
<p>Now, the great thing about AVR Studio &#8211; is that you can use it to run your code in a simulator, which allows you to debug the code, while monitoring the status of registers, i/o ports etc..</p>
<p>Before we can simulate the code we need to include a file in our AVR Studio project (which gives device dependant info) at the beginning of the code. (a range of inc files can be found in the &#8216;Appnotes&#8217; subdirectory of yr AVR Studio install)</p>
<pre class="code">.include "m8def.inc"</pre>
<p>Then select; Project -&gt; Build and run&#8230; You&#8217;ll need to select the chip you&#8217;re working with.  Select View -&gt; &#8216;registers&#8217; &amp; &#8216;new io view&#8217;&#8230; then you can step through yr code with F10 and examine it&#8217;s effect.</p>
]]></content:encoded>
			<wfw:commentRss>http://ntsdt.net/2008/08/08/first-steps-with-atmel-assembly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
