Programming the ATmega168

There are several ways to get your program onto an ATmega168, the way I'm doing it is with one of these programmers and some jumper wires  - essentially I followed the SparkFun tutorial here.  This is something that I'm working on at the moment:

 

But you could also use one of these Olimex development boards, which is another way I have tried (and means that you can dispense with all those jumper wires).

The AVR pocket programmer is good because pretty much any PC has USB these days (you can also use serial or parallel ports to program an ATmega).  But the pocket programmer can also provide a 5v power supply from USB.

If you want to build your own programmer (which would probably be the cheapest option) then take a look that this, which should get you able to build a programmer for the cost of some wire, resistors and a parallel port connector (assuming that you have a PC with a parallel port).  For me, I found it easiest to just buy something from SparkFun.  In my experience the pocket programmer only works when attached to a USB hub, I've never managed to get it to work when plugged directly into the USB port of my PC - I've never bothered to find out why.

Of course, the other thing you'll need is a development tool, so that you can compile your source code and get the resulting output file copied to the processor.  I'm using WinAVR, or more specifically the portable version which is here.  The portable version means that I can put my development environment on a memory stick and use it on whatever computer I happen to be sat in front of.  Very nifty.

So when you're armed with 1) a programmer, and 2) a copy of WinAVR ...you should be ready to go.  You'll need some code to compile!  I'm going to post that next.

Comments are closed